microsoft access driver problems

S

somersbar

hey,

ive been trying to set up a web form in visual basic.net that can
access a microsoft access database. i need to use odbc also. i can get
it working using a windows form but not a web form. might be that ive
set up the database wrong using the odbc data source administrator?

i get an error saying that it cant find the data source, when i put in
the following line of code in my webform.aspx.vb file:
"OdbcDataAdapter1.Fill(DataSet11)"

Can anyone tell me exactly how to go about setting up my access
database using odbc data source administrator, and what exactly i need
in my connection string? the end program is supposed to be an on-line
booking system. should i use a File DSN, or a System DSN?
 
K

Kevin Spencer

ive been trying to set up a web form in visual basic.net that can
access a microsoft access database. i need to use odbc also. i can get
it working using a windows form but not a web form. might be that ive
set up the database wrong using the odbc data source administrator?

First of all, I have to question your assertion the "i need to use odbc."
ODBC is really almost obsolete. It is/was a wrapper for OLE DB, but now you
can use OLE DB directly with a large variety of (almost any) data sources,
including Access/Jet. It will perform much better for you, and you don't
need a DSN at all, just a Connection String. Here's a sample OLE DB
Connection String for Access (using standard security, and compliments of
http://www.connectionstrings.com):

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User
Id=admin;Password=;

Note that the Connection String contains all the information you would need
to put into a DSN. But you don't have the external dependency upon a DSN, or
the headache of having to create/maintain a DSN.

You would use the .Net System.Data.OleDb Namespace and related classes,
which are almost exactly the same as the ODBC and other provider namespace
classes, such as OleDbCommand, OleDbConnection, OleDbDataAdapter, etc.

Try it out, and see if it doesn't make your life easier. Here's a link to a
good MSDN article about creating your Connection:

http://msdn.microsoft.com/library/d...l/vbtskcreatingconnectiontoaccessdatabase.asp

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
To a tea you esteem
a hurting back as a wallet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top