Datatype error in critera expression

xxdcmast
04-16-2004, 10:38 AM
I am using this sql string to do a search in a table and output the data
SELECT Balance FROM Customers WHERE PIN =" &x& "
where x is an integer
dim x as integer

but i keep getting

Adodc
Datatype error in criteria expression

Any ideas why?

RedLeader
04-16-2004, 10:58 AM
I am using this sql string to do a search in a table and output the data
SELECT Balance FROM Customers WHERE PIN =" &x& "
where x is an integer
dim x as integer

but i keep getting

Adodc
Datatype error in criteria expression

Any ideas why?





Try this
dim SQL AS STRING
Dim x AS integer
SQL="SELECT Balance FROM Customers WHERE PIN =" & x

Adodc.recordset=SQL
adodc.refresh ' if this is nessesary

xxdcmast
04-16-2004, 11:18 AM
Do I put that in the adodc record source command text because thats where I had my original code but that didnt work. Or do I have to put this somewhere else. I havent done any programming like the one you have shown above.

Is there any way I can just put the variable in the menu in the adodc properties?

This works
SELECT Balance FROM Customers WHERE PIN = 1111
and this doesnt
SELECT Balance FROM Customers WHERE PIN =" &x&"
even though I have x dim as integer

RedLeader
04-16-2004, 11:44 AM
you remove have to remove averithing from Adodc property page befor you start to write this code

Private sub Form_load ()
dim yourconnstring as connection
dim sSQL as String
dim x as integer
conn.connectionstring="yourconnstring"
sSQL="SELECT Balance FROM Customers" ' for example

With adodc
.connectionstring =conn
.recordset=sSQL
end with

end sub
private sub Command1_click()
' you can put this anywhere
sSQL="SELECT Balance FROM Customers WHERE PIN =" & x

Adodc.recordset=SQL
adodc.refresh

end sub

This have to work

G.Genchev

xxdcmast
04-16-2004, 12:01 PM
Thanks for your help but I have absoultely no idea *** is going on here I give up

HardCode
04-16-2004, 02:13 PM
It may server you better to get rid of the ADODC data controls, as they are problematic, and check out the ADO tutorial by Optikal on this forum. You'll be happy you did :)

MKoslof
04-16-2004, 06:10 PM
Yes, you need to review the ADO tutorial...using an ADO connection and recordset will be much more flexible. And you mention that this is an integer value, if so, you need to change your select statment:



"SELECT Balance FROM Customers WHERE PIN =" & x

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum