Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Server problem
Message
 
 
To
09/02/2007 12:29:11
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01194131
Message ID:
01194142
Views:
11
>>I am having a problem with a select from SQL Server. My code is as follows:
>>
>>*lcPermId = alltrim(companyinfo.PermID) && removed for testing
>>lcPermID = '1178072'
>>lnProgramYear = companyinfo.yearproduced
>>lcRawTable = addbs(fileloc) + "surveys\RawData" + transform(lnProgramYear) + '.dbf'
>>
>>lcConnectionString = "DRIVER=SQL Server;SERVER=PAG-SQLSERVER;" + ;
>>		"UID=DonF;APP=Microsoft Visual FoxPro;" + ;
>>		"WSID=TPD284;DATABASE=TRPSurvey;Trusted_Connection=Yes"
>>lnHandle = sqlstringconnect(m.lcConnectionString)
>>lcSQL = "select * " + ;
>>	"from TRPSurvey" + "..exported " + ;
>>	"where lcPermID = alltrim(PermID)"
>>
>>sqlexec(m.lnHandle,lcSQL,"crsImport")
>>sqldisconnect(m.lnHandle)
>>
>>
>>The problem is that the select does not return any records when the WHERE clause is used even though I know there are records that meet the criteria. If I drop the WHERE clause it works fine and returns all of the records. Does SQL Server not support WHERE?
>>
>>- Don
>
>I believe it doesn't like ALLTRIM() part. Try:
>
>"where lcPermID = '"+alltrim(PermID)+"'"
>
Looks like it should be the other way around, though I may be wrong. PermID sounds more like a field name than lcPermID.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform