dataAdapter.....dataset

J

JH

This code failed miserably. And the error shows on the ConnectionT.open()
ans say exception occured in system.oldbb. .......

any help please



Dim ConnectionStringT As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Password='';" & _

"User ID=Admin;Data Source= C:\temp\account.mdb;" & _

"Jet OLEDB:Database Password='password';"

Dim ConnectionT As OleDbConnection = New OleDbConnection (connectionStringT)

Dim sqlCommandT As String = "SELECT * from acc_general where pinNumber =" +
TPinNumber


Dim commandT As OleDbCommand = New OleDbCommand(sqlCommandT)

commandT.CommandType = CommandType.Text

ConnectionT.Open()

commandT.Connection = ConnectionT

Dim oleDBDataadapterT As OleDbDataAdapter = New OleDbDataAdapter

oleDBDataadapterT.SelectCommand = commandT

Dim LogDsT As New DataSet

oleDBDataadapterT.Fill(LogDsT, "acc_general")

TCbalance = LogDsT.Tables(0).Rows(0)(2).ToString()
 
W

William Ryan eMVP

JH:

This is what your connectoin string actually is:
"Provider=Microsoft.Jet.OLEDB.4.0;Password='';User ID=Admin;Data Source= C:\temp\account.mdb;Jet OLEDB:Database Password='password';"

Here's what it should be:

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\account.mdb;User Id=admin;Password=password;"

or "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\account.mdb;;Jet OLEDB:Database Password=password;"

The first one looks like what you need. Let me know if it doesn't work. You have Password twice in your first connection string.

ALso, you may want to wrap you connection.open in a try{}catch(OleDbException ex){Debug.Assert(false, ex.ToString());}

Or something like this so you can find out more info and the whole app doesn't blow up. I'd also have a if(File.Exists("C:\temp\account.mdb"); before I tried referencing it.

LEt me know if you still ahve any problems.

Cheers,

Bill
 

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

Top