<%
Response.flush
Response.Buffer = True
On Error Resume Next
Function SQLQuote(var)
If InStr(var, "'") <> 0 Then
var = Replace(var, "'", "''")
End If
SQLQuote = var
End Function
Function ConnectDB()
If Err.Number <> 0 Then
ConnectDB = True
Else
ConnectDB = False
End If
End Function
If ConnectDB = False Then
Dim MyDB
Dim MyDSN
Dim MySQL
Dim MyRS
Dim rowCount
Dim idm
Dim MCode
Dim Mh
Dim Yr
Dim Responsed
Dim Position
Dim Remark
Set MyDB = Server.CreateObject("ADODB.Connection")
MyDSN = "dsn=mysqlsample;uid=srathee;pwd=advantage;"
MyDB.open MyDSN
MySQL = "SELECT * FROM member Order by ID desc"
Set MyRs = MyDB.execute (MySQL)
If ConnectDB = False Then
AddTraining()
Public Function AddTraining()
MySQL = "Insert Into member ("
MySQL = MySQL & "user,"
MySQL = MySQL & "pass,"
MySQL = MySQL & ") "
MySQL = MySQL & "Values ("
MySQL = MySQL & "" & user & ","
MySQL = MySQL & "" & pass & ","
MySQL = MySQL & ");"
Set MyRS = MyDB.execute (MySQL)
End Function
End If
MyRS.Close
MyDB.Close
Set MyRS = Nothing
Set MyDB = Nothing
%>
ถ้า Check Error จะเจอ
System Error Occured !
Number : -2147217900
Description : [MySQL][ODBC 3.51 Driver][mysqld-4.0.1-alpha-nt]You have an error in your SQL syntax near ') Values (5,5,)' at line 1
<!--#Include File="../Connections/ProductionODBC.inc" -->
<%
Response.flush
Response.Buffer = True
On Error Resume Next
Function SQLQuote(var)
If InStr(var, "'") <> 0 Then
var = Replace(var, "'", "''")
End If
SQLQuote = var
End Function
Function ConnectDB()
If Err.Number <> 0 Then
ConnectDB = True
Else
ConnectDB = False
End If
End Function
If ConnectDB = False Then
Dim MyDB
Dim MyDSN
Dim MySQL
Dim MyRS
Dim rowCount
Dim idm
Dim MCode
Dim Mh
Dim Yr
Dim Responsed
Dim Position
Dim Remark
MySQL = "SELECT * FROM Monthplan Order by ID desc"
Set MyRs = MyDB.execute (MySQL)
idm = (MyRs("Mcode"))
MyRS.Close
Set MyRS = Nothing
End If
MCode = idm+1
Mh = Trim(Request.Form("Mh"))
Yr = Trim(Request.Form("Yr"))
Responsed = Trim(Request.Form("Responsed"))
Position = Trim(Request.Form("Position"))
Remark = Trim(Request.Form("Remark"))
If ConnectDB = False Then
AddTraining()
Public Function AddTraining()
MySQL = "Insert Into Monthplan ("
MySQL = MySQL & "Mcode,"
MySQL = MySQL & "Mh,"
MySQL = MySQL & "Yr,"
MySQL = MySQL & "Responsed,"
MySQL = MySQL & "Position,"
MySQL = MySQL & "Remark"
MySQL = MySQL & ") "
MySQL = MySQL & "Values ("
MySQL = MySQL & "" & Mcode & ","
MySQL = MySQL & "'" & SqlQuote(Mh) & "',"
MySQL = MySQL & "'" & SqlQuote(Yr) & "',"
MySQL = MySQL & "'" & SqlQuote(Responsed) & "',"
MySQL = MySQL & "'" & SqlQuote(Position) & "',"
MySQL = MySQL & "'" & SqlQuote(Remark) & "'"
MySQL = MySQL & ");"
MyRS.Close
MyDB.Close
Set MyRS = Nothing
Set MyDB = Nothing
End Function
End If
%>
<script>
var redirecturl="Production.asp"
var pausefor=0
function postaction(){
if (window.timer){
clearInterval(timer)
clearInterval(timer_2)
}
window.location=redirecturl
}
setTimeout("postaction()",pausefor*1000)
</script>
ใครช่วยแก้ปัญหาให้หน่อยครับระบบ Production Record เปลี่ยนจาก Access มาเป็น MySQL เลยเจอปัญหาใหญ่เลย.................