|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
hello all.. i need help regarding following SQL statement. I just want to use the value i get from my dpname variable and use it in my SQL statement in the following manner.
my code: dim dpname dpname = request.form("dptname") for s = 0 to UBound(arrname) sql_insert="UPDATE" & <%=dpname%> & "SET Units =" &unitarray(s)& ",Submitted =' "&theDate&" ' " sqlin=sql_insert+" WHERE Items =' " & arrname(s) & " ';" Conn.Execute sqlin NExt error showen in IE: Error Type: Microsoft VBScript compilation (0x800A03EA) Syntax error /aspwork/addform.asp, line 60, column 23 sql_insert="UPDATE" & <%=dpname ----------------------^ |
|
#2
|
|||
|
|||
|
The dpname is it a table name?
Update [table name] set [column name]=[value to update] where [condition] PS: I think you should leave some space as code show below also Code:
sql_insert="UPDATE " & <%=dpname%> & " SET Units =" &unitarray(s)& ",Submitted =' "&theDate&" ' " sqlin=sql_insert+" WHERE Items =' " & arrname(s) & " ';" |
|
#3
|
||||
|
||||
|
Try
Code:
dpName = Request.Form("dptname")
For i = 0 To UBound(arrname)
Conn.Execute("UPDATE " & dpName & " Set Units = " & unitArray(i) & ", Submitted = #" & theDate & "# WHERE Items = '" & arrName(i) & "';")
Next
|
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > get value from variable to use in SQL statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|