Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO connection to SQL server

Status
Not open for further replies.

ChrisHiggins

Programmer
Jan 14, 2004
11
GB
I am using VB6 to connect to an SQL server vie ADO if I use the following code I can connect.

stSQLMsg = "Select * from [purchase_interface] "
With objConn
.Provider = "SQLOLEDB"
.Properties("Data Source").Value = stSqlServer
.Properties("Initial Catalog").Value = stSqlDatabase
.Properties("User ID").Value = stSqlSignon
.Properties("Password").Value = stSqlPassword
.CursorLocation = adUseClient
.Open
End With
objRs.Open stSQLMsg, objConn, adOpenDynamic, adLockOptimistic


'Filter the records to those for processing
objRs.Filter = "[interfaced] = " & False
objRs.MoveLast
lngRecordCount = 0
lngTotalRecords = objRs.RecordCount
objRs.MoveFirst

But if I use

stSQLMsg = "Select * from [purchase_interface] Where [interfaced] = " & False
With objConn
.Provider = "SQLOLEDB"
.Properties("Data Source").Value = stSqlServer
.Properties("Initial Catalog").Value = stSqlDatabase
.Properties("User ID").Value = stSqlSignon
.Properties("Password").Value = stSqlPassword
.CursorLocation = adUseClient
.Open
End With
objRs.Open stSQLMsg, objConn, adOpenDynamic, adLockOptimistic

I get an error

What am I doing incorrect?

Thanks for any help anybody can give

Chris

 
What type is the interface field?


"Own only what you can carry with you; know language, know countries, know people. Let your memory be your travel bag.
 
Solved the problem by using [interfaced] = 0 instead of False.

Thanks it was your query that put me in the right direction.

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top