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

Command contains unrecognized phrase/keyword.

Status
Not open for further replies.

ChuckG

MIS
Feb 28, 2001
211
US
I must be brain dead today, I've seen this error before, but this piece of code I'm working on I just can't see why I'm getting it here.

The entire error is
[Microsoft][ODBC Visual FoxPro Driver]Command contains unrecognized phrase/keyword.

This is the line that is getting that error.

ObjRS.Open strSQL, objConn

Here's what those variables are set to
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
objConn.ConnectionString = "DSN=test1"
strSQL = "UPDATE int_dis SET control = '"& ctrl &"', contact = '"& contact &"', company = '"& company &"', addr1 = '"& addr1 &"', addr2 = '"& addr2 &"'"

I thought at first it was due to the strSQL being longer than 255 characters, but as you can see by the one I'm using now I chopped it down so it would be shorter.

Any suggestions?

Thanks
ChuckG
 
what happens when u print out the sql string? what's the command that it comes out with?
 
It's setting the strSQL to this.

UPDATE int_dis SET control = '1', contact = 'CHUCK', company = 'CHUCK'S MARINA ', addr1 = '1 SIERRA PLACE ', addr2 = 'A23 '

 
Unless it's a typo could it be the ' in chuck's.

--------------------------------
Rome did not create a great empire by having meetings, they did it by killing all those who opposed them.
 
Yep, that's what it was. (wasn't a typo, but I removed it and it ran fine) I was thinking that since it was within quotes it would consider it a piece of text rather than a single quote.

Thanks for the extra hand/eye :)

Chuck
 
No problem.

Of course if you need to have an apostrophe in the name or address fields you could use the replace function and replace with two apostrophe's i.e.

company = Replace(company, "'", "''")

This will then just place one apostrophe in your database. This works in fine Access but not sure about Visual FoxPro.

--------------------------------
Rome did not create a great empire by having meetings, they did it by killing all those who opposed them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top