Adding a record to a Database?
Hi I'v been trying to insert a record to a database using this code:
Quote:
Set editCmd = Server.CreateObject("ADODB.Command")
editCmd.ActiveConnection = "dsn=Message;"
editCmd.CommandText = "insert into Posts (Date_added,Name,Email,Subject,Text) values ('5/29/2001 8:00:24 PM','Stephen','
[email protected]','Test','Testing.') "
editCmd.Execute
editCmd.ActiveConnection.Close
to create a Message Board, but I always get this error :eek::
Quote:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
/syt/BillBoard/Index.asp, line 91
I'm totaly clules why this is happening :confused:
Help!!!!!!!!!!! :cool:
Hey again Aniz with another solution
Your sql fine ,it has no error,The main thing when your passing
a sql through Ado it doesn't accept the field names if it is a reserved word. Your sql has reserve word TEXT as a field name ,
When Ado finds this text as one of the field name it generates the error
first you go to the table and change the FIELDNAME TEXT to TTEXT
then just try the modified sql now
editcmd.CommandText = "insert into Posts (date_added,Name,Email,Subject,ttext) values ('5/29/2001 8:00:24 PM','Stephen','[email protected]','Test','Testing.') "
hope this helps much.
bye.