Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Server problem
Message
 
 
À
09/02/2007 12:29:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01194131
Message ID:
01194142
Vues:
10
>>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform