[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

create Data layer

Posted on 2013-01-02
4
Medium Priority
?
220 Views
Last Modified: 2013-01-05
When creating DAL, data layer, I generally create something like below to return dataset.  

Public Function Fill_Grid() As DataSet
        Dim ds As New DataSet
        Using Sqlcon As New SqlConnection(WebConfigurationManager.ConnectionStrings("myConnectionString").ToString)
            Using SqlComnd As New SqlCommand("mysp", Sqlcon)
                SqlComnd.CommandType = CommandType.StoredProcedure
                Using sqlAD As New SqlDataAdapter(SqlComnd)
                    sqlAD.Fill(ds)
                End Using
            End Using
        End Using
        Return ds
    End Function

My question is when I create SqlDataSource1 like below, how would I create my DAL? Or Do I even need it?




 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:myConnectionString %>"
                            SelectCommand="mysp" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
0
Comment
Question by:VBdotnet2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 38738303
No. ASP.Net will take care of it for you. I don't think that is the best way to consume data though.
0
 

Author Comment

by:VBdotnet2005
ID: 38738325
Would you just create a function to return dataset like above then?
"No. ASP.Net will take care of it for you. I don't think that is the best way to consume data though. ", Could you clarify this a bit?
0
 
LVL 27

Accepted Solution

by:
Chinmay Patel earned 1000 total points
ID: 38738372
Sure. I would have written a big paragraph but this particular answer saved me, here: http://forums.asp.net/p/1543479/3766438.aspx
0
 
LVL 25

Assisted Solution

by:Rouchie
Rouchie earned 1000 total points
ID: 38739472
There is an article here also about how to make functions like yours into reusable objects
http://www.codepal.co.uk/show/How_to_make_subroutines_and_functions_reusable_across_your_entire_aspnet_application
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question