Solved

create Data layer

Posted on 2013-01-02
4
207 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 250 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 250 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a‚Ķ
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall‚Ķ

732 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