November 8, 2001 at 4:05 am
Hi, 1st post, please excuse any rule breaking. I've been trying to update a table thru ASP, and tried many diffrent ways to update the fields. Here's the code, the variables are passed from a form, this page is the 'form action'.
txtSupportID=request.querystring("LogNo")
txtEngineer=request.querystring("Engineer")
txtProgress=request.querystring("Progress")
txtFixDate=Date()
Set dbConn=Server.CreateObject("ADODB.Connection")
dbConn.open "PROVIDER=SQLOLEDB;DATASOURCE=Internal;UID=sqlweb;PWD=internal;DATABASE=SupportDB;"
strSQL = "select * from helpdesk where SupportID = 'txtSupportID'"
Set RS = dbConn.Execute(strSQL)
Dim SQLStmt
SQLStmt = "UPDATE helpdesk SET progress = 'txtProgress' where SupportID = 'LogNo'"
dbConn.Execute(SQLStmt)
I've also put in a couple of document.write statements containing the above txtVariables,
to check that they're being passed, which they are.
I don't get any error messages, and don't get any table updates either!
November 8, 2001 at 4:20 am
SQLStmt = "UPDATE helpdesk SET progress = 'txtProgress' where SupportID = 'LogNo'"
should read
SQLStmt = "UPDATE helpdesk SET progress = 'txtProgress' where SupportID = 'txtSupportID'"
November 8, 2001 at 5:43 am
Your update statement should be
SQLStmt = "UPDATE helpdesk SET progress = '" & txtProgress & "' where SupportID ='" & LogNo & "'"
November 8, 2001 at 6:01 am
I'd tried that method before and got no joy, it looks like it's worked that time, thanks.
I need to add extra parameters to the SET
line, but I think I'm on to a winner now, cheers.
Edited by - JonTout on 11/08/2001 06:05:11 AM
November 8, 2001 at 8:57 am
Glad it worked, Jon.
One thing that I do: write out your sql using response.write. Then cut and paste into Query Analyzer to check for syntax errors.
Steve Jones
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply