I have two .asp pages and am using FP2003 with a SQL database. One is called insert.asp and it prompts a user to input a value into a text box called Account. The second page is called insert2.asp and it is the Database Results region page that inserts the record into a table. Account is defined in the database table as nchar(10) and allows nulls.
I have an issue when trying to INSERT records into a table. Using the DRW, I have the following SQL statement:
INSERT INTO TblVehicle (AccountNr1) VALUES('::AccountID::')
When I press Verify Query, I get the following error:
The Custom Query Contains Errors
If I use a literal like this:
INSERT INTO TblVehicle (AccountNr1) VALUES('guest01')
I do not get the error and the value is inserted into the table without problem.
I looked around on the Internet and found this syntax workaround:
INSERT INTO TblVehicle (AccountNr1) VALUES('"&request.form("Ac
countID")&
"')
...and when I click Verify Query, it's fine. But when I submit the page. it gives me the following error:
Database Results Wizard Error
Description: String or binary data would be truncated.
Number: -2147217833 (0x80040E57)
Source: Microsoft OLE DB Provider for SQL Server
I have noticed when viewing the code on the second page that extra quotes are being placed in the query string:
fp_sQry="INSERT INTO TblVehicle (AccountNr1) VALUES('""&request.form(""
AccountID"
")&""')"
I cannot get a simple insert into a database to work when using the custom query. It is driving me nuts. Any help would be TREMENDOUSLY appreciated.
Thanks
Tim
Start Free Trial