Solved

create Data layer

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

785 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