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

Run SQL Command limit in Visual Foxpro 6.0

Status
Not open for further replies.

dickylam

IS-IT--Management
Jun 24, 2001
86
I have a problem. Since a single command line cannot exceed 256 chars. All the time when I execute some SQL command to SQL server 7.0 will appear problem.

Example
x = space(200)

store "insert dbtable (fieldx) values ('&x')" to sqlcmd
store sqlprepare(sqldatabasehandle,[&sqlcmd] to zresult
store sqlexec(sqldatabasehandle) to zresult2

the above result will be ok.

BUT, if I change variable x into space(500), then I will get an error. Therefore this will limit to me to allow user to input a memo like editbox and save back to SQL table.

Anybody know how to solve it.


Much Thanks.


 
Try this:

lcFieldx = space(200)
SQLExec(sqldatabasehandle, "insert (fieldx) values (?lcFieldx)")


Foxpro will automatically fill in parameters in a SQL statement. A parameter is any label with a ? in front of it, like ?lcFieldx, and if there is already a variable named with that label, like lcFieldx above, Fox will just use the value of the variable. If there is no such variable Fox will prompt the user for a value.
 
Yes install Service Pack 5.0

this is very little unknown bug in Foxpro 6.0 and 5.0

It drove me nuts for a couple of years until they fixed it.

What it does is trunkcates the Sql commonad when it sends it to SQL Server. The varible you create looks good and everthing else looks good but What SQL server gets it, its a garbled command.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top