The above gives me "The specified table does not exist". Is there a way to force the value of Request.Form("transaction" into this open statement?
mmmmmm, based on what i see "transaction" is set on the previous FORM (you do a request.form). That you use it in the next line is no proof at all.
"Transaction" must be a valid SQL statement. When you respond.write this to screen, you can inspect this (or copy/paste this to eg the SQL Query Manager).
I see the confusion. I am not launching a sql statement from transaction. Transaction contains the table name to open the recordset. The platform I am using doesn't allow me to do use - recordset sql connection.
rsUpdate.Open (Request.Form("account"), conn seems to work the way I want it to. Thanks for your help.
But, I am getting another error with conn.Execute("insert into " & Request.Form("account" & " (" & Request.Form("transaction" & " value ('" & Request.Form("amount" & "')" which is right after rsUpdate.Open Request.Form("account", conn. The error message I am getting is: The operation requested by the application is not allowed if the object is closed. If I comment out the conn.execute line and check the state of the connection and recordset are open(1).
first: the current statement is eg
conn.Execute("insert into OHC (debet) value ('100')"
but this is money, so i think:
conn.Execute("insert into OHC (debet) value (100)"
is better.
second:
With INSERT INTO i normally do not use a recordset object, because i normally do not want to receive something back (exception: in cases where i want to know the value of an identity field). I simply execute the SQL statement. This is much simpler:
'- - - - - - - -
if(Request.Form("transaction"<>"" then
dim cSQL
cSQL = "insert into " & Request.Form("account" & " (" &_
Request.Form("transaction" &_
" value (" & Request.Form("amount" & ""
conn.Execute(cSQL)
end if
'- - - - - - - -
third:
When you want to do someting with the results from your SQL statement, you create a recordset. So change the part after the IF-statement from above:
But this summation is something SQL can do for you (much faster), and you know that too (because it's commented now).
' - - - - - - - -
' Construct the SQL
cSQL = "select sum(debit), sum(credit) " &_
"from checking"
' Run the SQL and put it into a record set
rsChk.open cSQL, conn
Thanks for most of that. I would use the sql sum function but it seems not to be supported by pocketASP. I am still having a problem with conn.Execute("insert into " & Request.Form("account" & " (" & Request.Form("transaction" & " value (" & Request.Form("amount" & "". The apostrophes were only a minor issue with the statement. I can only guess that the connection is lost just before the execute statment or using post data doesn't work with the connection in pocketASP. code below:
<%
dim conn,sql
dim rsChk,rsOhc,rsSav,rsUpdate
dim chkBalance,savBalance,ohcBalance
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.