Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2004

Tip: Looking for answers? Try searching our database.

Access Database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lou - 22 Oct 2004 18:17 GMT
Where can I find sample code to connect/use an Access DB, all the microsoft
samples require SQL and I don't have that. This will be my first .Net app!

Scared...
scorpion53061 - 22 Oct 2004 18:34 GMT
Don't be scared. Plenty of MS samples use Access

http://www.connectionstrings.com/

http://support.microsoft.com/kb/821765/EN-US/

> Where can I find sample code to connect/use an Access DB, all the
> microsoft
> samples require SQL and I don't have that. This will be my first .Net
> app!
>
> Scared...
Lou - 22 Oct 2004 19:51 GMT
I can't get it to work?
Why doesn't my grid populate

Dim conn As New OleDbConnection

Dim myData As OleDbDataReader

Dim cmd As New OleDbCommand

Dim connString As String

Dim i As Integer

Try

' Set the connection string.

connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= D:\Lou
Projects\Projects.mdb"

' Open the connection.

conn.ConnectionString = connString

conn.Open()

'Set the command properties.

cmd.Connection = conn

cmd.CommandText = "SELECT * from client"

myData = _

cmd.ExecuteReader(CommandBehavior.CloseConnection)

Try

While (myData.Read)

'Process data.

DataGrid1.DataSource = myData

End While

Finally

myData.Close()

End Try

Catch ex As Exception

'Error handling

Debug.Write(Err.Description)

End Try

End Function 'GetAccessData

> Don't be scared. Plenty of MS samples use Access
>
[quoted text clipped - 8 lines]
>>
>> Scared...
Ken Tucker [MVP] - 23 Oct 2004 14:01 GMT
Hi,

       You can not bind a window form grid to a datareader.  that is only
available for the webform based one.  Use a dataset instead.

Dim strConn As String

Dim strSQL As String

Dim da As OleDbDataAdapter

Dim conn As OleDbConnection

strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"

strConn &= "Data Source = Northwind.mdb;"

conn = New OleDbConnection(strConn)

da = New OleDbDataAdapter("Select * From Categories", conn)

da.Fill(ds, "Categories")

DataGrid1.DataSource = ds .Tables("Categories")

Ken

--------------
I can't get it to work?
Why doesn't my grid populate

Dim conn As New OleDbConnection

Dim myData As OleDbDataReader

Dim cmd As New OleDbCommand

Dim connString As String

Dim i As Integer

Try

' Set the connection string.

connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= D:\Lou
Projects\Projects.mdb"

' Open the connection.

conn.ConnectionString = connString

conn.Open()

'Set the command properties.

cmd.Connection = conn

cmd.CommandText = "SELECT * from client"

myData = _

cmd.ExecuteReader(CommandBehavior.CloseConnection)

Try

While (myData.Read)

'Process data.

DataGrid1.DataSource = myData

End While

Finally

myData.Close()

End Try

Catch ex As Exception

'Error handling

Debug.Write(Err.Description)

End Try

End Function 'GetAccessData

> Don't be scared. Plenty of MS samples use Access
>
[quoted text clipped - 10 lines]
>>
>> Scared...
Shiva - 22 Oct 2004 18:37 GMT
http://support.microsoft.com/kb/308278/EN-US/

http://www.codeproject.com/cs/database/csharpaccessdb.asp

Hope these help.

Where can I find sample code to connect/use an Access DB, all the microsoft
samples require SQL and I don't have that. This will be my first .Net app!

Scared...

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.