Here is the code I'm working on:
Select Case nErr
Case "0"
sSQL = "SET NOCOUNT ON;" &_
"INSERT INTO ztblDiabeticLog (LoggedDate, FirstName, MiddleInitial, LastName, InsVerified, SignedCopy, OnFile, AOBDate, SalesRep, PodNumber, EnteredBy) VALUES ('" & Now() & "', '" & sFN & "', '" & sMI & "','" & sLN & "', " & iIV & ", '" & sSignedOn & "', " & iCopy & ", '" & sAOBDate & "', '" & sRep & "', '" & sPod & "', '" & request.Cookies("UserID") & "');" &_
"SELECT @@IDENTITY AS NewID;"
Response.Write sSQL & "<br>"
Set RS = conn.Execute(sSQL,,1)
NoteID = RS.Fields("NewID")
sSQL = "INSERT INTO ztblDiabeticNotes (DID, Notes, EnteredBy, TimeDate) VALUES (" & NoteID & ", '" & sNotes & "', '" & request.Cookies("UserID") & "', '" & now() & "')"
Response.Write sSQL
Set RS = Conn.Exectue(sSQL,,1)
Response.Redirect("Diabetics_Main.asp")
Case "1"
Response.Write ErrMsg
Response.Write "<li>Please use the BACK button and fill in the missing fields"
End Select
The response.write sSQL is just so I can see the values for testing. My problem is the first SQL statement executes and gives me back @@IDENTITY fine. The second SQL statemtent is throwing up this error:
ADODB.Connection error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/Sales/Diabetics_Submit.asp, line 75
Below is what is being written to the ASP page. I can copy and paste this into SQL's query analyzer and run it and it will insert the row, but it will not do it from the ASP page????
INSERT INTO ztblDiabeticNotes (DID, Notes, EnteredBy, TimeDate) VALUES (65, 'test', 'XXXXXX', '10/6/2004 9:57:49 AM')
Select Case nErr
Case "0"
sSQL = "SET NOCOUNT ON;" &_
"INSERT INTO ztblDiabeticLog (LoggedDate, FirstName, MiddleInitial, LastName, InsVerified, SignedCopy, OnFile, AOBDate, SalesRep, PodNumber, EnteredBy) VALUES ('" & Now() & "', '" & sFN & "', '" & sMI & "','" & sLN & "', " & iIV & ", '" & sSignedOn & "', " & iCopy & ", '" & sAOBDate & "', '" & sRep & "', '" & sPod & "', '" & request.Cookies("UserID") & "');" &_
"SELECT @@IDENTITY AS NewID;"
Response.Write sSQL & "<br>"
Set RS = conn.Execute(sSQL,,1)
NoteID = RS.Fields("NewID")
sSQL = "INSERT INTO ztblDiabeticNotes (DID, Notes, EnteredBy, TimeDate) VALUES (" & NoteID & ", '" & sNotes & "', '" & request.Cookies("UserID") & "', '" & now() & "')"
Response.Write sSQL
Set RS = Conn.Exectue(sSQL,,1)
Response.Redirect("Diabetics_Main.asp")
Case "1"
Response.Write ErrMsg
Response.Write "<li>Please use the BACK button and fill in the missing fields"
End Select
The response.write sSQL is just so I can see the values for testing. My problem is the first SQL statement executes and gives me back @@IDENTITY fine. The second SQL statemtent is throwing up this error:
ADODB.Connection error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/Sales/Diabetics_Submit.asp, line 75
Below is what is being written to the ASP page. I can copy and paste this into SQL's query analyzer and run it and it will insert the row, but it will not do it from the ASP page????
INSERT INTO ztblDiabeticNotes (DID, Notes, EnteredBy, TimeDate) VALUES (65, 'test', 'XXXXXX', '10/6/2004 9:57:49 AM')