John Baird
Coatesville, Pennsylvania, United States
General information
Title:
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)
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only