Note that there are some explanatory texts on larger screens.

plurals
  1. POASP Session value
    primarykey
    data
    text
    <p>I'm setting a Session of MM_CustomerID in my code and then further down the page I need to insert the value of that session into a table. But each time I try to do this it comes up with an Invalid column name 'varCustomerID'.</p> <p>At the top of the page I have this code;</p> <pre><code>&lt;% set rscustomerid = Server.CreateObject("ADODB.Recordset") rscustomerid.ActiveConnection = CmdAddCustomer.ActiveConnection rscustomerid.Source = "SELECT @@IDENTITY as MaxCustomersID FROM Customers" rscustomerid.CursorLocation = 2 rscustomerid.LockType = 3 rscustomerid.Open() Session("MM_CustomerID")=rscustomerid("MaxCustomersID") Session("MM_UserAuthorization") = "5" %&gt; </code></pre> <p>Then further down, i'm trying to set a variable of varCustomerID to be equal to the MM_CustomerID session;</p> <pre><code>&lt;% varCustomerID = Session("MM_CustomerID") %&gt; </code></pre> <p>And then try inserting the value of that variable varCustomerID into the Orders table as follows;</p> <pre><code>&lt;% 'Insert record into Orders recordset when form is submitted 'and store the unique OrderID 'Version Date: 09 August 2009 set CmdAddOrder = Server.CreateObject("ADODB.Command") CmdAddOrder.ActiveConnection = MM_dbconn_STRING CmdAddOrder.CommandText = "INSERT INTO Orders (OrderCustomer,OrderGrandTotal,OrderStatus) VALUES (varCustomerID,0.00,3)" CmdAddOrder.CommandType = 1 CmdAddOrder.CommandTimeout = 0 CmdAddOrder.Prepared = true CmdAddOrder.Execute() %&gt; </code></pre> <p>I wondered if anyone might be able to help? Perhaps there's an easier way of just inserting the session value into the table, instead of creating a variable for it?</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload