Milkus1
asked on
Cant fill using Odbc.OdbcDataAdapter ...Why?
Here is my code. I was using sqlclient.sqldataadapter prior, but had to change due to the application's development.
I have moved to Odbc, but now cant get datasets to fill. What am I missing. The connection is open...
Dim lsSQL As String
Dim lrs As New Odbc.OdbcDataAdapter
Dim lCommand As Odbc.OdbcCommand
Dim ds As New DataSet
Login = False
lsSQL = "Select * FROM tblUser " ' WHERE UserName = " & qStrSQL(User) & " AND activeFlg = 1"
'lsSQL = "Select * FROM tblUser WHERE UserName = " & qStrSQL(User) & " AND activeFlg = 1"
lCommand = New Odbc.OdbcCommand(lsSQL, gConn)
lrs.SelectCommand = lCommand
lrs.Fill(ds)
I have moved to Odbc, but now cant get datasets to fill. What am I missing. The connection is open...
Dim lsSQL As String
Dim lrs As New Odbc.OdbcDataAdapter
Dim lCommand As Odbc.OdbcCommand
Dim ds As New DataSet
Login = False
lsSQL = "Select * FROM tblUser " ' WHERE UserName = " & qStrSQL(User) & " AND activeFlg = 1"
'lsSQL = "Select * FROM tblUser WHERE UserName = " & qStrSQL(User) & " AND activeFlg = 1"
lCommand = New Odbc.OdbcCommand(lsSQL, gConn)
lrs.SelectCommand = lCommand
lrs.Fill(ds)
does the qStrSQL function add the single quotes to the string? That is the only thing that i can think of
Try this
"select * from tblUser where (username = '" + qStrSQL(User) + "') and (activeFlg = 1)"
"select * from tblUser where (username = '" + qStrSQL(User) + "') and (activeFlg = 1)"
Dim lsSQL As String
Dim lrs As New Odbc.OdbcDataAdapter
Dim ds As New DataSet
Login = False
lsSQL = "Select * FROM tblUser "
lrs = new Odbc.OdbcDataAdapter("SELE CT * FROM tblUser", gConn);
lrs.Fill(ds)
Dim lrs As New Odbc.OdbcDataAdapter
Dim ds As New DataSet
Login = False
lsSQL = "Select * FROM tblUser "
lrs = new Odbc.OdbcDataAdapter("SELE
lrs.Fill(ds)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the replies
qstrSql is places the single quotes in the string.
Brackets don t make a difference and testing the statement without the Where clause still fails
No luck with any of the others ;o(
qstrSql is places the single quotes in the string.
Brackets don t make a difference and testing the statement without the Where clause still fails
No luck with any of the others ;o(
ASKER
The answer is...
My connection string used a standard DSN connection format not the SQL server format.
Therefore the connection opened by the errors were caused during execution of statements
thanks for everyones help
My connection string used a standard DSN connection format not the SQL server format.
Therefore the connection opened by the errors were caused during execution of statements
thanks for everyones help