?
Solved

Using sqlDataAdapter instead of OleDbDataAdapter

Posted on 2005-05-16
3
Medium Priority
?
873 Views
Last Modified: 2008-02-01
Having trouble connecting to teh database using the oledbadapter, however sqlDataAdapter works fine. However, I'm nto sure how to alter this bit of code to do that, need some help

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Put user code to initialize the page here


            'Dim partoftown = Session("partoftown")
            ' Dim partoftown = "kensington"

            Dim conPubs As SqlConnection
            Dim cmdSelect As SqlCommand
            Dim dtrAuthors As SqlDataReader


            Dim objConn As OleDbConnection = New OleDbConnection("Server=server1;uid=administrator;pwd=werty69;Database=findandview;Provider=SQLOLEDB")
            Dim objCommand As OleDbDataAdapter = New OleDbDataAdapter("Select * from maintable where area = 'Kensington'", objConn)


            Dim ds As DataSet = New DataSet
            objCommand.Fill(ds)

            Dim objPds As PagedDataSource = New PagedDataSource
            objPds.DataSource = ds.Tables(0).DefaultView
            objPds.AllowPaging = True
            objPds.PageSize = 5
   
...
0
Comment
Question by:dprasad
  • 2
3 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 14013319
Then use the SQL Client, it is better that way anyway :)

Bob
0
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 14013320
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Put user code to initialize the page here


            'Dim partoftown = Session("partoftown")
            ' Dim partoftown = "kensington"

            Dim conPubs As SqlConnection
            Dim cmdSelect As SqlCommand
            Dim dtrAuthors As SqlDataReader


            Dim objConn As New SQLConnection("Server=server1;uid=administrator;pwd=werty69;Database=findandview;Provider=SQLOLEDB")
            Dim objCommand As  New SQLDataAdapter("Select * from maintable where area = 'Kensington'", objConn)


            Dim ds As DataSet = New DataSet
            objCommand.Fill(ds)

            Dim objPds As PagedDataSource = New PagedDataSource
            objPds.DataSource = ds.Tables(0).DefaultView
            objPds.AllowPaging = True
            objPds.PageSize = 5
0
 
LVL 24

Accepted Solution

by:
Jeff Certain earned 2000 total points
ID: 14013330
Your connection string will have to be:
  "Data Source=servername;Initial Catalog=databasename;User ID=userName;pwd=password"
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
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…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

831 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