Solved

using sqldatasource vs connecting to database in code, asp.net

Posted on 2009-06-29
1
296 Views
Last Modified: 2012-05-07
Is there much difference using a sqldatasource on the .aspx page vs connecting via code?
like
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"
        SelectCommand="sp_INSERT_to_HistoryTable" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:ControlParameter ControlID="Comment1A_Set1_10" Name="Acct"
                PropertyName="Text" Type="String" />
            <asp:ControlParameter ControlID="Comment1A_Set2_10" Name="SerNum"
                PropertyName="Text" Type="String" />
            <asp:Parameter Name="Str1" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
vs in code, something like this:
        Dim SeaConn As New System.Data.OleDb.OleDbConnection("Provider=SQLOLEDB.1;xxxxxxxxxxx")
        Dim cmd As New OleDbCommand(strSQL)
        SeaConn .Open()
        cmd.Connection = SeaConn
        cmd.ExecuteNonQuery()
        SeaConn .Close()
0
Comment
Question by:avoorheis
[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
1 Comment
 
LVL 7

Accepted Solution

by:
Chris-Chambers earned 500 total points
ID: 24737335
Hi,

I've only tried using an sqldatasource once, and I found that the connection took between 10 an 15 times longer to connect (or rather the page took that much longer to render) than using code.

(This was tried on a production server in live conditions.)

Of course there could have been other factors at work but I have never bothered trying again, the code version works well enough for me with no performance worries to keep me up at night.

Hope this helps,

Chris.

0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

752 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