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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How INSERT numeric from textbox?

Status
Not open for further replies.

warik

Programmer
Jun 28, 2002
169
0
0
ID
This is the problem:

I have 2 textbox, lets say name (char) and old (int).

When I want to insert is value to SQL, I have a problem, and it said Operator/operand type mismatch.

I use this code to do that:
INSERT INTO mydata (name,old) VALUES ('"+thisform.name.value+"',"+thisform.old.value+") INTO CURSOR mycursor

What should I do?

Thank you in advance
 
you have to change any numeric data to string so you can concatenate it with other strings.

... + alltrim(str(thisform.old.value)) + ...

but, is that a valid syntax? in vfp6 it's not.

kilroy [trooper]
 
or you can use this:
transform(thisform.old.value)
 
kilroy & bon011, sorry forgot to tell you that the mydata structure is:

name char(20)
old num(3)


So I cannot use str() at this problem.
Maybe someone could help me?

Thank's in advance
 
warik

Have you tried this?
INSERT INTO mydata (name,old) VALUES (thisform.name.value,thisform.old.value) INTO CURSOR mycursor

You shouldn't have to use the quotes, and it shouldn't matter if the values are characters or numeric.
Or am I missing something, are you triying to add them together?


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
You right Mike,
I have to write all my coe for this problem. I would like to use it at my SQLEXEC function.
This is all code:


NumRows = SQLEXEC(myConnection, "insert into mydata (name,old) values ('"+thisform.name.value+"',"+thisform.old.value+")", 'MyCursor2')


Thank's
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top