John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Titre:
SQL INSERT FAILURE FROM VFP50! Help!
Once again I'm pulling out my hair. I got the previous sql problem solved
by using ' instead of ". Now, the following snippet won't insert the record
into SQL Server. If I use the following lcSQL with the expanded values in
the statement, from ISQL-w it works just fine, from my program it
returns -1. Help!
Do I need to DBSet some property? I am not using a view but inserting
directly into the table.
*****************************************************************************
STORE SQLCONNECT('MyDataBase', 'sa') TO gnConnHandle
IF gnConnHandle <= 0
RETURN
ENDIF
lcLoginID='john'
lnSessionID = VAL(RIGHT(SYS(3) + SYS(3),10))
lnStudentID = 26
lcRemoteAddress = '177.100.100.98'
lcSQL = [INSERT INTO Sessions (SessionID, LoginID, LoginDate, UserType,UserID, ] +;
[CdromDrive, IPAddress, CurrentCourse, Comment) VALUES (] + ;
ALLTRIM(STR(lnSessionID)) + [, '] + lcLoginId +[', '] +TTOC(DTOT(DATE())) +;
[', 'STUDENT', '] + ALLTRIM(STR(lnStudentId)) + "', 'None', '" +lcRemoteAddress +;
[', ' ', ' ')]
lcErrorCode = SQLEXEC(gnConnHandle, lcSql)
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement