dix
|
| Posted: 05/24/2002, 8:54 AM |
|
hello.
i'm using asp w/templates and need to access the pk of a newly created record. i started using the example here: http://www.gotocode.com/art.asp?art_id=80&
i want to grab field ID in table ministires based on the field EmailLogin and create a new session variable to pass called ID2. i modified the code to get rid of the "unterminated string response" error and unrecognized character errors to this:
pkSQL = "select ID from ministires where EmailLogin = “ & ToSQL(fldEmailLogin, “Text”)"
openrs rs, pkSQL
last = GetValue(rs, "ID")
session(ID2) = last
note: the first 2 lines here are acutally one line in my code. i added the final quotes after (fldEmailLogin, "Text")" and took out the quotes from session ("ID2") to get the page to display without errors.
however, now the page with the code will display and the record will insert, but i get the following error:
Microsoft JET Database Engine (0x80040E14)
Undefined function 'ToSQL' in expression.
/christian/thdb/Common.asp, line 34
any hints as to the problem with the code would be appreciated
|
|
|
 |
dix
|
| Posted: 05/24/2002, 10:34 AM |
|
getting warmer: i found from another search that the original code syntax works correctly, but cutting and pasting from the sample gives you the slanted quotes instead of straight up and down quotes. the straight up and down ones will work.
|
|
|
 |
Nicole
|
| Posted: 05/25/2002, 2:27 AM |
|
Dix,
the tip about quotes is correct, you should retype them manually.
Also please try following code:
pkSQL = "select ID from ministires where EmailLogin = " & ToSQL(fldEmailLogin, "Text")
openrs rs, pkSQL
last = GetValue(rs, "ID")
session("ID2") = last
|
|
|
 |
|