รบกวนผู้รู้หน่แยนะ(การ update) code คือ Dim Conn Set Conn=Server.CreateObject
code คือ
<%
Dim Conn
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.open "DBQ=" & Server.MapPath ("test_project_update.mdb" )&";Driver={Microsoft Access Driver (*.mdb)}"
'==========================Update in table Employee
SQL = " Update employee set emp_id = '" & Request.Form("emp_id") & "',title_name = '" & request.Form("title_name") & "'," & _
"name_thai = '" & Request.Form("name_thai") & "',surname_thai = '" & Request.Form("surname_thai") & "'," & _
"post_id = '" & Request.Form("post_id") & "',org_id = '" & Request.Form("org_id") & "'," & _
"e_mail = '" & Request.Form("e_mail") & "',tel = '" & Request.Form("tel") & "'" & _
" WHERE emp_id = " & Request.Form("emp_id")
Set oCmd = Server.CreateObject("ADODB.Command")
Set oCmd.ActiveConnection = Conn
oCmd.CommandText = SQL
oCmd.Execute
'===========================
'==========================Update in table User
SQL = " Update user set username = '" & request.Form("username") & "'," & _
"password = '" & Request.Form("password") & "',Clearance=" & Request.Form("usergroup") & _
" WHERE id = " & Request.Form("id")
Set oCmd = Server.CreateObject("ADODB.Command")
Set oCmd.ActiveConnection = Conn
oCmd.CommandText = SQL
oCmd.Execute
'response.Write(SQL)
'===========================
' response.Write(Request.Form("id"))
Response.Redirect("employee.asp")
%>
-----------------------------------------------------------------------------------------------------------------------------------------
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (comma) in query expression 'emp_id = 4444, 3333'.
/program/update_employee1.asp, line 18
Tag : - - - -
Date :
9 ส.ค. 2551 13:42:26
By :
test
View :
1487
Reply :
1
เช็คดู base และก็ ตรง
"post_id = '" & Request.Form("post_id") & "',org_id = '" & Request.Form("org_id") & "'," & _
"e_mail = '" & Request.Form("e_mail") & "',tel = '" & Request.Form("tel") & "'" & _
" WHERE emp_id = " & Request.Form("emp_id")
ช่วงนี้ไห้ดีดีอ่ะครับ มันจะเป็น '' ระวังเรื่องของตรงนี้ครับ
Date :
11 ส.ค. 2551 18:55:36
By :
terayut
Load balance : Server 03