dfranklyn
2005-09-01 15:24:54 UTC
I am trying to insert a record into sqlser 2000/2005. I can query and update
existing records but not insert. I don't get an error on the command but
nothing is posted to the table. My code looks like this
<begin code>
#DEFINE SQL_NAME "devsql"
#DEFINE SQL_UID ""
#DEFINE SQL_PWD ""
*~~~~~~~~~~~
LOCAL lcSQLConnStr, ;
lnSQLConnHandle, ;
lnSQLExecSuccess
lcSQLConnStr = "DRIVER={SQL Server};SERVER=" + SQL_NAME + ;
";DATABASE=MEMBERSHIP;UID=" + SQL_UID + ";PWD=" + SQL_PWD
lnSQLConnHandle = SQLSTRINGCONNECT(lcSQLConnStr)
IF lnSQLConnHandle < 1
LOCAL laErrArray[1]
AERROR(laErrArray)
WAIT WINDOW "Unable to connect:" + CHR(13) + laErrArray[3]
RETURN .F.
ENDIF
SET STEP ON
LOCAL inmemnumb as String
inmemnumb = '1234567'
lnconn=SQLCONNECT('devsql')
lnSQLExecSuccess = SQLEXEC(lnSQLConnHandle, "insert into
newmemb(id,local,pri_loc,folio,lastname,f_init);
values('1234567','0495','0000','T''ALDRIDGE','L')")
lnSQLExecSuccess = SQLEXEC(lnSQLConnHandle, "SELECT * from newmemb where id
= ?inmemnumb ", "RESULTS")
SQLDISCONNECT(lnSQLConnHandle)
IF SELECT("RESULTS") > 0
SELECT RESULTS
BROWSE NOWAIT
ENDIF
<end code>
Can anyone tell me why the insert is not working?????
dfw
existing records but not insert. I don't get an error on the command but
nothing is posted to the table. My code looks like this
<begin code>
#DEFINE SQL_NAME "devsql"
#DEFINE SQL_UID ""
#DEFINE SQL_PWD ""
*~~~~~~~~~~~
LOCAL lcSQLConnStr, ;
lnSQLConnHandle, ;
lnSQLExecSuccess
lcSQLConnStr = "DRIVER={SQL Server};SERVER=" + SQL_NAME + ;
";DATABASE=MEMBERSHIP;UID=" + SQL_UID + ";PWD=" + SQL_PWD
lnSQLConnHandle = SQLSTRINGCONNECT(lcSQLConnStr)
IF lnSQLConnHandle < 1
LOCAL laErrArray[1]
AERROR(laErrArray)
WAIT WINDOW "Unable to connect:" + CHR(13) + laErrArray[3]
RETURN .F.
ENDIF
SET STEP ON
LOCAL inmemnumb as String
inmemnumb = '1234567'
lnconn=SQLCONNECT('devsql')
lnSQLExecSuccess = SQLEXEC(lnSQLConnHandle, "insert into
newmemb(id,local,pri_loc,folio,lastname,f_init);
values('1234567','0495','0000','T''ALDRIDGE','L')")
lnSQLExecSuccess = SQLEXEC(lnSQLConnHandle, "SELECT * from newmemb where id
= ?inmemnumb ", "RESULTS")
SQLDISCONNECT(lnSQLConnHandle)
IF SELECT("RESULTS") > 0
SELECT RESULTS
BROWSE NOWAIT
ENDIF
<end code>
Can anyone tell me why the insert is not working?????
dfw