|  | 
	                
 
  
    |  |  
    | 
        
        บันทึกข้อมูลไม่ได้ทั้งที่ Code เหมือนกัน ? Response.flush  Response.Buffer = TrueOn Error Resume Next Function SQLQuote(var)     |  
    |  |  
 
	
		|  |  |  |  |  
		|  |  | 
          
            | <% 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)
 
 idm = (MyRs("user"))
 idn = (MyRs("pass"))
 
 MyRS.Close
 Set MyRS = Nothing
 End If
 
 user = idm+1
 pass = idn+1
 
 Response.write("user = " & idm & "<br>")
 Response.write("pass = "& idn & "<br>")
 
 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
 
 และไม่บันทึกข้อมูลให้ด้วยแต่อีกอัน Code เหมือนกันแต่ไม่มี Error ทำไงดีครับช่วยหน่อย
 
 
 *-------------------------- อันที่บันทึกได้----------------------------------------
 
 <!--#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 & ");"
 
 Set MyRS = MyDB.execute (MySQL)
 
 If Err <> 0 then
 Response.write("<br><font face=MS Sans Serif  color=red size=2>")
 Response.write "System Error Occured !   " & " <br><br> "
 Response.write "<u>Number</u> : " & err.number & "<br>"
 Response.write "<u>Description</u> : " & err.description & "<br><br>"
 Response.Write(MyMessage_HD) & " !  <br>"
 Response.write("</font>")
 Response.write("<font face=MS Sans Serif  color=blue size=2>")
 Response.Write(MyMessage_Conn) & "<br>"
 Response.Write(MyMessage_Actor) & " < "
 Response.Write(MySession) & " > <br>"
 Response.Write("Body Shop Department  Ext. 6110") & "<br><br>"
 Response.write("</font>")
 Response.write("<font face=MS Sans Serif  color=red size=2>")
 Response.Write("<u>Detail</u> : ") & "<br>"
 Response.write("</font>")
 Response.write("<font face=MS Sans Serif  color=blue size=2>")
 Response.Write("Data Fails or Connection Fails") & " <br> "
 Response.Write(MyMessage_Detail) & "<br>"
 Response.Write("Permissions Fails In Server") & " "
 Response.Write(MySERVER_NAME) & "  "
 Response.Write(MySERVER_PROTOCOL) & "  "
 Response.Write(MyHTTP_CONNECTION) & " <br> "
 Response.write("</font>")
 Response.End
 End If
 
 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 เลยเจอปัญหาใหญ่เลย.................
          
 
 Tag : - - - -
 
 |  
            |  |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          17 เม.ย. 2548  09:16:02 | By :
                          M@C | View :
                          3245 | Reply :
                          5 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |  
		|  |  |  |  |  
  
    | 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ผมคิดว่าถ้าใช้กับดาต้าเบสของมายเอสคิวแอล คุณควรจะเปลี่ยนชื่อตัวแปรไม่ให้เหมือนชื่อฟิลด์ในดาต้าเบส คิดว่าน่าจะแก้ไขได้นะครับ...ลองดูนะ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            18 เม.ย. 2548  16:21:26 | By :
                            นายกระจอก |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Description : [MySQL][ODBC 3.51 Driver][mysqld-4.0.1-alpha-nt]You have an error in your SQL syntax near ') Values (5,5,)' 
 Sql Statement ผิดนะครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            19 เม.ย. 2548  11:58:45 | By :
                            @W_IN |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ผมมีปัญหาเขียนภาษา asp บันทึกข้อมู,ใน access ไม่ได้    รันแล้วขึ้น เพจบอกว่า 
 
 
 dsn can not updat database or object is read - only
 
 
 ผู้รู้ชี้ทางหลุดพ้นให้ด้วยครับ ลองมาหลายครั้งแล้วครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-01-20 19:45:23 | By :
                            บาร์ |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ปรับ permission ดูครับ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-01-20 21:06:21 | By :
                            Akatsuki |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ไปที่ property ของ folder ที่เก็บไฟล์ access นะครับ 
 เลือก tab security แล้ว add user IUSR_ชื่อของเครื่องคอมพิวเตอร์นั้นๆ
 
 แล้วก็ให้สิทธิ์ เขียนข้อมูลลงไป
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-03-03 12:02:53 | By :
                            Aod47 |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  |  |