This browser does not support basic Web standards, preventing the display of our site's intended design. May we suggest that you upgrade your browser?
Use ADO to add or update records instead of SQL statements. Easy to implement and debug.
'Assumes:
' 1. You have a connection string set up using an ADO provider or driver
' 2. Your connection object is objCon
' 3. You have stored the data you wish to add into variables.
'This example is using an Access database with an autonumber data type as the
'primary key. This method is ideal for those situations because you are not
'required to insert all of the fields.
'By leaving out the autonumber field when you use ADO Recordsets, the database
'will auto-increment for you!
'You call this by passing the name of the database table
' Example: AddRecord "Customer_table"
Sub AddRecord(strTable)
Dim rsADO
Set rsADO = Server.CreateObject("ADODB.Recordset")
rsADO.Open strTable, objCon,1,3
rsADO.AddNew ' Just remove this line to do an update
rsADO("C_Name") = strC_Name
rsADO("C_addr") = strC_addr
rsADO("C_email") = strC_email
rsADO("C_phone") = strC_phone
rsADO.Update
rsADO.Close
End Sub