 |
|
สอบถามเกี่ยวกับ mySmartUpload ในการส่งค่าข้ามฟอรมเพื่อทำการแก้ไข |
|
 |
|
|
 |
 |
|
ทำการแก้ไขฟอร์มอัพโหลดค่ะ โดยมี Element อื่นๆด้วย เมื่อทำการส่งค่าผ่าน id=request.QueryString("sap_id") แล้วระบบฟ้อง Error ดังนี้
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[MySQL][ODBC 5.1 Driver][mysqld-5.0.45-community-nt-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') = '' WHERE sap_id = '530000006'' at line 1
/FixIT_3/admincp/admin_sap/Admin_result_formComPsap.asp, line 55
หน้ารับค่าค่ะ
Code (ASP)
Dim a,b,c,d,e,f,g,testVare
a=DatePart("yyyy",Date())
b=DatePart("m",Date())
c=DatePart("d",Date())
d=DatePart("ww",Date())
e=Hour(Now())
f=Minute(Now())
g=Second(Now())
testVare=a&b&c&d&e&f&g
Dim mySmartUpload
Dim Conn,strSQL,objExec,id
'*** Create Object ***'
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
'*** Upload Files ***'
mySmartUpload.Upload
'*** Upload file1 ***'
If mySmartUpload.Files("sap_re_pb").FileName <>"" Then
mySmartUpload.Files("sap_re_pb").SaveAs(Server.MapPath("AdminFiles/" &testVare& mySmartUpload.Files("sap_re_pb").FileName))
Response.write mySmartUpload.Files("sap_re_pb").Name & " Uploaded.<br>"
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER={MySQL ODBC 5.1 Driver}; SERVER=localhost;UID=root; " & _
"pwd=root;database=tknrepair;option=16384;"
strSQL = "UPDATE job_sap SET "
strSQL = strSQL&"sap_re_pb = '"&testVare&mySmartUpload.Files("sap_re_pb").FileName&"' "
strSQL = strSQL&",sap_it_comment = '"&mySmartUpload.Form("sap_it_comment")&"' "
strSQL = strSQL&",sap_date_final = '"&mySmartUpload.Form("sap_date_final")&"' "
strSQL = strSQL&",sap_time_final = '"&mySmartUpload.Form("sap_time_final")&"' "
strSQL = strSQL&",sap_status) = '"&mySmartUpload.Form("sap_status)")&"' "
strSQL = strSQL&"WHERE sap_id = '"&mySmartUpload.Form("SAP_ID")&"' "
Set objExec = Conn.Execute(strSQL) ====>> line 55
If Err.Number = 0 Then
Response.write("Save Done.")
Else
Response.write("Error Save ["&strSQL&"] ("&Err.Description&")")
End IF
Conn.Close()
Set objExec = Nothing
Set Conn = Nothing
else
Response.Redirect "Admin_formComPsap.asp?errtext= Plest Attach File PB"
end if
ไม่ทราบว่าต้องแก้ไขอย่างไรคะ
และอีก 1 คำถามค่ะ กรณีที่ใช้ การอัพโหลด ร่วมกับ text ทำไมเวลาเรียกข้อมูลจากฐานข้อมูลมาแสดง ขึ้นเป็น ?????? ส่วนหน้าอื่นๆ ยังปกติค่ะ ซึ่งปัญหานี้ต้องแก้ไขอย่างไร
ขอบคุณค่ะ

Tag : ASP, MySQL, VBScript
|
|
 |
 |
 |
 |
Date :
2011-01-31 16:21:26 |
By :
nodlife |
View :
1713 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Syntax ของ MySQL ตอนที่ Update น่าจะไม่ถุกต้องครับ หรือไม่ลอง
Code (ASP)
Response.write strSQL
Set objExec = Conn.Execute(strSQL) ====>> line 55
เอาค่า SQL Statement ออกมาดูครับ
|
 |
 |
 |
 |
Date :
2011-02-01 08:58:52 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองใช้คำสั่งดูแล้วค่ะ
Code (ASP)
strSQL = "UPDATE job_sap SET"
strSQL = strSQL&"(sap_status = '"&mySmartUpload.Form("sap_status")&"' "
strSQL = strSQL&",sap_re_pb = '"&mySmartUpload.Files("sap_re_pb").FileName&"' "
strSQL = strSQL&",sap_date_final = '"&mySmartUpload.Form("sap_date_final")&"' "
strSQL = strSQL&",sap_time_final = '"&mySmartUpload.Form("sap_time_final")&"' "
strSQL = strSQL&",sap_it_comment = '"&mySmartUpload.Form("sap_it_comment")&"' "
strSQL = strSQL&"WHERE sap_id = '"&mySmartUpload.Form("sap_id")&"' ) "
Response.write strSQL
ค่าที่ได้
sap_re_pb Uploaded.
UPDATE job_sap SET(sap_status = 'ดำเนินการเสร็จสิ้น' ,sap_re_pb = 'Sunset.jpg' ,sap_date_final = '01/02/2554' ,sap_time_final = '10:28:47' ,sap_it_comment = 'ได้รับแล้วครับกกกกกกกกกกกกกกกกกกก' WHERE sap_id = '530000006' )
ออกมาถูกตามที่เราต้องการ แต่พออัพเดทลงฐานข้อมูล
ก็ error
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[MySQL][ODBC 5.1 Driver][mysqld-5.0.45-community-nt-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(sap_status = 'ดำเนินการเสร็จสิ้น' ,sap_re_p' at line 1
error ตรง จังหวะอัพเดท
Code (ASP)
Set objExec = Conn.Execute(strSQL)
ไม่ทราบว่าต้องแก้ปัญหายังไงคะ
|
 |
 |
 |
 |
Date :
2011-02-01 10:27:03 |
By :
nodlife |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำการอัพเดทผ่านเเล้วค่ะ
แต่ติดปัญหาในเรื่องที่ถามไว้
"และอีก 1 คำถามค่ะ กรณีที่ใช้ การอัพโหลด ร่วมกับ text ทำไมเวลาเรียกข้อมูลจากฐานข้อมูลมาแสดง ขึ้นเป็น ?????? ส่วนหน้าอื่นๆ ยังปกติค่ะ ซึ่งปัญหานี้ต้องแก้ไขอย่างไร"
ทิ้ง Browser ไว้นานๆ เวลา Refresh จะขึ้นเป็น ????????
ต้องปิดเเล้วเปิด Browser ใหม่ ถึงจะแสดงภาษาไทยค่ะ
ขอบคุณล่วงหน้าค่ะ
|
 |
 |
 |
 |
Date :
2011-02-01 11:24:32 |
By :
nodlife |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณค่ะ ตอนนี้แก้ปัญหาได้เเล้ว ขอบคุณ mr.win ที่ทำให้เขียนเว็บได้สำเร็จค่ะ
|
 |
 |
 |
 |
Date :
2011-02-04 09:25:21 |
By :
nodlife |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|