Solved

create Data layer

Posted on 2013-01-02
4
201 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
  • 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now