Here's the code:
<%
// Create Memory Variable
Dim m_strSQL
//
// Build the SQL statement
m_strSQL = "INSERT INTO <TableName>(fieldname2,fieldname3,fieldname4,fieldname5,fieldname6, Etc...)
VALUES (Session('Variable2),Session('Variable3'),Session('Variable4'),Session('Variable5),Session('Variable6')Etc.....)"
// Create the MySQL Connection.
set MySQLConn = server.createobject("adodb.connection")
// Open the Database
MySQLConn.open "DRIVER={MySQL ODBC 3.51 Driver};SERVER=<IP Address>;DATABASE=<Database>;USER=<User>;PASSWORD=<Password>;OPTION=3;"
//
// Open recordset
Set objRS = MySQLConn.Execute(m_strSQL)
// Close the recordset
objRS.close
Set objRS = Nothing
// Close the database
MySQLConn.close
Set MySQLConn = Nothing
%>
The INSERT INTO statement gives me syntax errors immediately after the "VALUES" statement. How Come?
PS... I must use the global Session("variable1") variables and need to find out how to place them in the proper fields in the database.
I could change the global variables to local ones for this page by the Dim m_variable1,m_variable2,m_variable3
and then "m_variable1=Session("variable1") statements
and then try to insert VALUES (m_variable1,m_variable2)Etc..,
Would that work?
Thanks in anticipation.....
<%
// Create Memory Variable
Dim m_strSQL
//
// Build the SQL statement
m_strSQL = "INSERT INTO <TableName>(fieldname2,fieldname3,fieldname4,fieldname5,fieldname6, Etc...)
VALUES (Session('Variable2),Session('Variable3'),Session('Variable4'),Session('Variable5),Session('Variable6')Etc.....)"
// Create the MySQL Connection.
set MySQLConn = server.createobject("adodb.connection")
// Open the Database
MySQLConn.open "DRIVER={MySQL ODBC 3.51 Driver};SERVER=<IP Address>;DATABASE=<Database>;USER=<User>;PASSWORD=<Password>;OPTION=3;"
//
// Open recordset
Set objRS = MySQLConn.Execute(m_strSQL)
// Close the recordset
objRS.close
Set objRS = Nothing
// Close the database
MySQLConn.close
Set MySQLConn = Nothing
%>
The INSERT INTO statement gives me syntax errors immediately after the "VALUES" statement. How Come?
PS... I must use the global Session("variable1") variables and need to find out how to place them in the proper fields in the database.
I could change the global variables to local ones for this page by the Dim m_variable1,m_variable2,m_variable3
and then "m_variable1=Session("variable1") statements
and then try to insert VALUES (m_variable1,m_variable2)Etc..,
Would that work?
Thanks in anticipation.....