AccessDataSource1??
AccessDataSource1??
AccessDataSource1??
AccessDataSource1??
AccessDataSource1??
AccessDataSource1?? AccessDataSource1?? AccessDataSource1?? AccessDataSource1?? AccessDataSource1?? AccessDataSource1?? AccessDataSource1?? AccessDataSource1??
AccessDataSource1?? AccessDataSource1??
AccessDataSource1??
Go Back  Xtreme Visual Basic Talk > > > AccessDataSource1??


Reply
 
Thread Tools Display Modes
  #1  
Old 09-12-2010, 07:46 AM
rplp4 rplp4 is offline
Junior Contributor
 
Join Date: Apr 2005
Posts: 247
Default AccessDataSource1??


I need some help understanding how to get data from a data base. I have been searching for a few hours and find plenty of examples I cannot get to work and they do not have an explanation on how it should work.

I have an Access data base I would like to be able to get data from and write data to. I dropped AccessDataSource1 control on the page and connected using the smart tag. I have clicked the test query and see the connection is working. I have no idea how to get data using code.

I think it has something to do with AccessDataSource1.SelectCommand = "SELECT * FROM [Users]"?

Can anyone help/explain how this is done?
Reply With Quote
  #2  
Old 09-15-2010, 09:19 AM
GraniteGuy GraniteGuy is offline
Newcomer
 
Join Date: Sep 2010
Location: Manchester
Posts: 6
Default

Here's the code that I use to return a dataset (you have to pass in OleDbConnectionString)...
Code:
Try
                Dim objDA As OleDbDataAdapter
                Dim objDS As New DataSet
                objOleDbConnection = New OleDbConnection(OleDbConnectionString)
                objDA = New OleDbDataAdapter(strSQL, objOleDbConnection)
                objOleDbConnection.Open()

                If objOleDbConnection.State = ConnectionState.Open Then
                    objDA.Fill(objDS, "MyTableName")
                    objDA = Nothing
                    Return objDS
                End If

            Catch objException As OleDbException
                           Throw New Exception(objException)
            End Try
Reply With Quote
  #3  
Old 09-16-2010, 11:33 AM
rplp4 rplp4 is offline
Junior Contributor
 
Join Date: Apr 2005
Posts: 247
Default

Can you explain the code you have posted?

Thank you for your help
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
AccessDataSource1??
AccessDataSource1??
AccessDataSource1?? AccessDataSource1??
AccessDataSource1??
AccessDataSource1??
AccessDataSource1?? AccessDataSource1?? AccessDataSource1?? AccessDataSource1?? AccessDataSource1?? AccessDataSource1?? AccessDataSource1??
AccessDataSource1??
AccessDataSource1??
 
AccessDataSource1??
AccessDataSource1??
 
-->