 |
|
-2147467259::[Microsoft][ODBC Visual FoxPro Driver]Cannot update the cursor |
|
 |
|
|
 |
 |
|
ตามหัวข้อครับ ไม่ได้เป็นบ่อย แต่เป็นตอน update พร้อมกันจากหลาย เครื่อง
client ใช้ jquery post มาไฟล์ update.asp แล้ว update ตาม เงื่อนไข
ตอน post มาผ่านครับ แต่ตอน update ใช้น้อย ไม่เป็นไร แต่พอมากๆเข้าเป็นครับ
-2147467259::[Microsoft][ODBC Visual FoxPro Driver]Cannot update the cursor
พอมีแนวทางแก้ไขไหม 
Connections.asp
Class Connections
'constance
Private sPathData, sPathServer
'constructor
Public Default Function Connects(subPath, rootPath, fixPath) 'int, str,str
sPathData = "\"
sPathServer = ""
Dim loopPaht : loopPath = 0
Dim strPath : strPath = ""
if Len(Trim(fixPath)) > 0 then
sPathData = "\" & fixPath & "\"
end if
if Len(Trim(rootPath)) > 0 then
sPathServer = rootPath
end if
if subPath > 0 then
loopPath = subPath - 1
end if
For i = 0 to loopPath
strPath = strPath & "..\"
Next
sPathServer = strPath&rootPath
Set Connects = Me
End Function
'return obj oConn
Public Function OpenConn(ConnType, ConnSoure)
Dim oConn, ServerPath, MyDirectory, ChFile
'====== server on web ========
ServerPath = Server.MapPath(sPathServer)
if(Right(ConnSoure,1) <> "/" and Right(ConnSoure,1) <> "\" and Ucase(ConnType)="DBF")then
ConnSoure=ConnSoure & "\"
end if
ServerPath = ServerPath & ConnSoure
Set MyDirectory = Server.CreateObject("Scripting.FileSystemObject")
Set oConn=Server.CreateObject("ADODB.Connection")
if(Ucase(ConnType)="DBC")then
ChFile = MyDirectory.FileExists(ServerPath)
if(ChFile <> False)then
oConn.Open "DRIVER={Microsoft Visual Foxpro Driver};SourceType=DBC;EXCLUSIVE=NO;Mode=ReadWrite;SourceDB=" & ServerPath
end if
else
if(Ucase(ConnType)="DBF")then
ChFile = MyDirectory.FolderExists(ServerPath)
if(ChFile <> False)then
oConn.Open "DRIVER={Microsoft Visual Foxpro Driver};SourceType=DBF;EXCLUSIVE=NO;Mode=ReadWrite;SourceDB=" & ServerPath
end if
end if
end if
Set OpenConn = oConn
End Function
'return obj oConn
Public Function Set_conn(n, sFl, type_db)
Dim oConn
if(n <> "")then
if(Ucase(type_db)="DBF")then
Set oConn=OpenConn(type_db,sPathData & n & "\" & sFl)
end if
if(Ucase(type_db)="DBC")then
Set oConn=OpenConn(type_db,sPathData & n & "\" & sFl)
end if
else
if(Ucase(type_db)="DBF")then
Set oConn=OpenConn(type_db,sPathData & sFl)
end if
if(Ucase(type_db)="DBC")then
Set oConn=OpenConn(type_db,sPathData & sFl)
end if
end if
set Set_conn=oConn
End Function
'return obj Conn
Public Function Select_sql(strsql, oRs, oConn)
On Error Resume Next
oRs.Open strsql,oConn,1,3
set Select_sql=oRs
End Function
'/// check all Error in file
'return type true/false
Public Function Check_Conns(n, sFl, typeDb, strSql)
Dim oRs, pStatus, oConn,log : pStatus = false
if Check_conn(n, sFl, typeDb) then
set oRs = Server.CreateObject("ADODB.Recordset")
set oConn = Set_conn(n, sFl, typeDb)
pStatus = Check_sql(strSql, oRs, oConn)
end if
Check_Conns = pStatus
End Function
'////////////////////////////////////////////////////////////////// Private ////////////////////////////////////////////////////////////////
'return true/false
Private Function CheckConn(ConnType, ConnSoure)
Dim oConn, ServerPath, MyDirectory, ChFile, rConn
'====== server on web ========
ServerPath = Server.MapPath(sPathServer)
if(Right(ConnSoure,1) <> "/" and Right(ConnSoure,1) <> "\" and Ucase(ConnType)="DBF")then
ConnSoure=ConnSoure & "\"
end if
rConn = true
ServerPath = ServerPath & ConnSoure' : Response.Write ServerPath
Set MyDirectory = Server.CreateObject("Scripting.FileSystemObject")
Set oConn=Server.CreateObject("ADODB.Connection")
if(Ucase(ConnType)="DBC")then
ChFile = MyDirectory.FileExists(ServerPath)
if(ChFile = False)then
rConn = false
end if
else
if(Ucase(ConnType)="DBF")then
ChFile = MyDirectory.FolderExists(ServerPath)
if(ChFile = False)then
rConn = false
end if
end if
end if
CheckConn = rConn
End Function
'return true/false
Private Function Check_conn(n, sFl, type_db)
'On Error Resume Next
Dim rConns : rConns = true
if(n <> "")then
if(Ucase(type_db)="DBF")then
rConns=CheckConn(type_db,sPathData & n & "\" & sFl)
end if
if(Ucase(type_db)="DBC")then
rConns=CheckConn(type_db,sPathData & n & "\" & sFl)
end if
else
if(Ucase(type_db)="DBF")then
rConns=CheckConn(type_db,sPathData & sFl)
end if
if(Ucase(type_db)="DBC")then
rConns=CheckConn(type_db,sPathData & sFl)
end if
end if
Err.Clear
Check_conn=rConns
End Function
'return true/false
Private Function Check_sql(strsql, oRs, oConn)
'On Error Resume Next
Dim rStatus : rStatus = true
oRs.Open strsql,oConn,1,3
if Err.Number <> 0 then
rStatus = false
end if
oRs.Close
Err.Clear
Check_sql = rStatus
End Function
End Class
Dim oConnect : Set oConnect = (new Connections)(3,"","xxx") 'New
Update.asp
<!--#include file="../../assets/asp/Connections.asp" -->
<!--#include file="../../assets/asp/ManageData.asp" -->
<!--#include file="../../assets/asp/Tools.asp" -->
Dim oConnectx : Set oConnectx = (new Connections)(4,"","xxxx")
Dim oMg : Set oMg = (new ManageDatas)(oConnectx.Set_conn("xxxx","","DBF"))
rs = "xxxxx|" & update_command
Dim updateStatus
updateStatus = oMg.DbUpdate(rs)
rw = oTool.CreateLog("010","..\..\log", rs &" -- " & updateStatus )
response.Write updateStatus
%>
update class
Class ManageDatas
'constance
Public c
'constructor
Public Default Function ManageDb(o) 'conn, root folder, process [ table, field, value ]
Set c = o
Set ManageDb = Me
End Function
Private Function QueryCMD(s)
'On Error Resume Next
Dim e : e = False
If Session("is_admin") <> "" OR Session("is_user") <> "" Then
c.beginTrans
c.execute s
If Err.Number <> 0 Then
c.RollBackTrans
Else
c.CommitTrans
e = True
End If
End If
'rw(s)
'rw(Err.Description)
c.Close
QueryCMD = e
End Function
Public Function DbInsert(r) 'root folder, insert process[table,field,value]
Dim s, p
p = Split(r,"|")
s = "INSERT INTO " & Trim(p(0)) & " (" & Trim(p(1)) & ") VALUES(" & Trim(p(2)) & ")" ': oErr.rw(s)
DbInsert = QueryCMD(s)
End Function
Public Function DbUpdate(r)
Dim s, p
p = Split(r,"|")
s = "UPDATE " & Trim(p(0)) & " SET " & Trim(p(1))
DbUpdate = QueryCMD(s)
End Function
Public Function DbDelete(r)
Dim s, p
p = Split(r,"|")
s = "DELETE FROM " & Trim(p(0)) & " " & Trim(p(1))
DbDelete = QueryCMD(s)
End Function
Function rw(s)
Response.Write s : response.End
End Function
End Class
Tag : ASP, jQuery
|
ประวัติการแก้ไข 2015-12-25 09:42:20 2015-12-25 09:52:27 2015-12-25 10:00:51 2015-12-25 11:44:39 2015-12-25 11:46:31 2015-12-25 12:57:03 2015-12-28 09:11:13
|
 |
 |
 |
 |
Date :
2015-12-25 09:41:11 |
By :
wit_peter |
View :
2264 |
Reply :
8 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองดูครับ ตามที่ TC Admin บอก ต้องรอตามผล เพราะ loop update ที่เครื่องทดสอบไม่ผิดพลาดครับ แต่ก็ ขอบคุณมากครับ ที่แนะนำ  
|
 |
 |
 |
 |
Date :
2015-12-28 09:43:52 |
By :
wit_peter |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ยังเหมือนเดิมครับ.. งง
ที่แก้ไปก็ไปตรวจสอบการ connect , close, แล้วก็ set xxx = nothing แล้ว (เผือเปิดค้าง แล้วไม่เข้าเงื่อนไข) ก็ทำหมดแล้ว งง ยังเหมือนเดิมครับ
     
https://support.microsoft.com/en-us/kb/294469 ถ้าในกรณีนี้ ก็ไม่ได้แก้ไข table เลยนะครับ มีแต่ รอ อัพเดจ งงมาก
|
ประวัติการแก้ไข 2015-12-28 14:55:05
 |
 |
 |
 |
Date :
2015-12-28 14:52:38 |
By :
wit_peter |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เกิดจากข้อจำกัดของตัว databse foxpro เองหรือเปล่าครับ
|
 |
 |
 |
 |
Date :
2015-12-29 23:54:59 |
By :
sarapaol |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอนนี้ ความคิด กำลัง เบนไปทาง ความคิดเห็น No.4 ครับ ยังไงก็ขอบคุณครับ ตอนนี้ก็ยังเป็น แต่ลดลง ไม่บ่อยเหมือนแต่ก่อน ถามพี่ที่ทำงานด้วยกัน แต่พวกพี่เขาเขียนเป็นโปรแกรมจาก foxpro เลย ตอบได้แต่ส่วนของฐานข้อมูล ...    
แต่สำหรับการ insert ไม่พังเลย ก็เลยหันมาส่งสัย การ update นี้แหละ ไม่รู้ว่าส่วนไหน
แต่ table ที่ใช้ เป็น free table ครับ น่าจะมีส่วน
|
ประวัติการแก้ไข 2016-01-05 11:31:44 2016-01-05 11:57:44
 |
 |
 |
 |
Date :
2016-01-05 11:22:19 |
By :
wit_peter |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่น่าจะใช่น่ะครับ คิดว่าน่าจะเกิดจากการเรียกใช้ Connection มาก หรือ นานเกินไปหรือเปล่าครับ 
|
 |
 |
 |
 |
Date :
2016-01-05 20:26:29 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ถ้า การ เรียก connect มากๆ ตามที่ TC Admin : No.6 เกี่ยวข้อง ก็อาจจะใช่ครับ ( ไม่เคยเจอ ) timeout ไม่น่าเพราะ เปิดแล้วปิด (จากที่ได้ไล่ดู .close() เกือบหมดแล้ว) จากเดิมตาม ที่ระบุ
ลักษณะการทำงาน 
เพราะ เปิด ปิด บ่อย มาก ประมาณว่า กรอกช่องหนึ่ง update ลงฟิวด์ เลย ประมาณนี้ ลงที่ table เดียว ทั้ง read ทั้ง update แต่ read จะอ่านเฉพาะเข้าหน้ามาตอนแรกของแต่ละ user
ตัว connection ทำงานทุกครั้งจากการ update ครับ open->update->close ประมาณ user ละ 2 วิ (อย่างเร็ว) (ไม่รวม user อื่น ที่ update เวลาเดียวกัน )
ที่ต้องใช้ foxpro ทำก็เพราะ
เขาออกแบบมา ....   
ยังหาทางออกไม่ได้ ยังเป็นเหมือนเดิม
-2147467259::[Microsoft][ODBC Visual FoxPro Driver]Cannot update the cursor
          
|
ประวัติการแก้ไข 2016-01-06 10:08:33 2016-01-06 10:09:52 2016-01-06 10:13:49
 |
 |
 |
 |
Date :
2016-01-06 10:05:35 |
By :
wit_peter |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ยังแก้ไม่ตก.. พอ error แบบนี้ทีไร พาลทำให้เว็บ บันทึกแก้ไข ข้อมุลไม่ได้ตาม ไม่ได้ตาม พอมีใครมีแนวคิดไหม....   
|
 |
 |
 |
 |
Date :
2016-02-10 09:55:49 |
By :
wit_peter |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|