473,396 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Access Database

Lou
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...
Nov 21 '05 #1
4 915
Don't be scared. Plenty of MS samples use Access

http://www.connectionstrings.com/

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

"Lou" <lo********@comcast.net> wrote in message
news:r_********************@comcast.com:
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...


Nov 21 '05 #2
http://support.microsoft.com/kb/308278/EN-US/

http://www.codeproject.com/cs/databa...rpaccessdb.asp
Hope these help.

"Lou" <lo********@comcast.net> wrote in message
news:r_********************@comcast.com...
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...

Nov 21 '05 #3
Lou
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

"scorpion53061" <ad***@nospamherekjmsolutions.com> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl...
Don't be scared. Plenty of MS samples use Access

http://www.connectionstrings.com/

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

"Lou" <lo********@comcast.net> wrote in message
news:r_********************@comcast.com:
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...

Nov 21 '05 #4
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

--------------
"Lou" <lo********@comcast.net> wrote in message
news:37********************@comcast.com...
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

"scorpion53061" <ad***@nospamherekjmsolutions.com> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl...
Don't be scared. Plenty of MS samples use Access

http://www.connectionstrings.com/

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

"Lou" <lo********@comcast.net> wrote in message
news:r_********************@comcast.com:
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...


Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nicola | last post by:
Hi Everyone, I am new to programming and would like to know how to open an access Report from within vb 6. I am trying to write a program to organise cross stitch threads. I have found out how...
11
by: Rosco | last post by:
Does anyone have a good URL or info whre Oracle and Access are compared to one another in performance, security, cost etc. Before you jump on me I know Oracle is a Cadillac compared to Access the...
64
by: John | last post by:
Hi What future does access have after the release of vs 2005/sql 2005? MS doesn't seem to have done anything major with access lately and presumably hoping that everyone migrates to vs/sql. ...
52
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
49
by: Mell via AccessMonster.com | last post by:
I created databases on Access 2003 and I want to deploy them to users. My code was also done using 2003. If they have Ms Access 2000 or higher, will they be able to use these dbs with all code,...
17
by: Mell via AccessMonster.com | last post by:
Is there a way to find out where an application was created from? i.e. - work or home i.e. - if application sits on a (work) server/network, the IT people know the application is sitting...
34
by: Mathieu Trentesaux | last post by:
Hello I downloaded Office 2007 for this reason : It seems, once again, that it is impossible to save any modification done in a VBA library, from the main project in Access. The save button...
21
by: nihad.nasim | last post by:
Hi there, I have a database in Access that I need on the web. The web page should connect to the database and write records for certain tables and view records for others. I want to know a...
11
by: Harel | last post by:
I have a report SQL which have been working for a few weeks. Its large and the target database is large. It has 59 join, and I dont think there is anything I can do about this, since the DB I use...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.