dataadapter...dataset..connection

  • Thread starter Thread starter JH
  • Start date Start date
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()
 
Hi JW,

Are you sure that the password is password?

(I corrected it roughly normaly should this do it).

Dim ConnectionStringT As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= C:\temp\account.mdb;"
Dim ConnectionT As OleDbConnection = New OleDbConnection
(connectionStringT)
Dim sqlCommandT As String = "SELECT * from acc_general where pinNumber =" &
TPinNumber
Dim oleDBDataadapterT As New
OleDbDataAdapter(sqlCommandT,ConnectionStringT)
Dim LogDsT As New DataSet
oleDBDataadapterT.Fill(LogDsT, "acc_general")
TCbalance = LogDsT.Tables(0).Rows(0)(2).ToString()

What is TCbalance and better is to use an command.parameter, but I think you
can try this first

I hope this helps?

Cor
 
Back
Top