还是内存溢出的问题,大家帮忙看看 (200分)

M

mafan

Unregistered / Unconfirmed
GUEST, unregistred user!
SQL语句是这样:
SQL:=‘SELECT * FROM tbl_004 WHERE Field_00 In (select Field_00 from tbl_006 where (Field_03 Like "*sohu*") or (Field_04 Like "*sohu*") or (Field_05 Like "*sohu*") )’;

DB.OpenRecordset(SQL,dbOpenSnapshot,dbConsistent,dbPessimistic);

内存溢出
大概有数据不到1000条,
ACCESS2000的数据库,在ACCESS2000里面运行查询不出错,但用程序运行就错,帮忙看看,应该这么作?


[red]
现在一用LIKE就溢出,
select * from tbl_A where field_a like "*sohu*"
(field_a是255长的字符串类型)
而且在98下不会溢出
[/red]
 
db 是什么??????
 
uses DAO2000;

Engine:DBEngine;
DB:Database;
 
OpenRecordset Method Example

This example uses the OpenRecordset method to open five different Recordset objects and display their contents. The OpenRecordsetOutput procedure is required for this procedure to run.

Sub OpenRecordsetX()

Dim wrkJet As Workspace
Dim wrkODBC As Workspace
Dim dbsNorthwind As Database
Dim conPubs As Connection
Dim rstTemp As Recordset
Dim rstTemp2 As Recordset

' Open Microsoft Jet and ODBCDirect workspaces, Microsoft
' Jet database, and ODBCDirect connection.
Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
Set wrkODBC = CreateWorkspace("", "admin", "", dbUseODBC)
Set dbsNorthwind = wrkJet.OpenDatabase("Northwind.mdb")
Set conPubs = wrkODBC.OpenConnection("", , , _
"ODBC;DATABASE=pubs;UID=sa;PWD=;DSN=Publishers")

' Open five different Recordset objects and display the
' contents of each.

Debug.Print "Opening forward-only-type recordset " & _
"where the source is a QueryDef object..."
Set rstTemp = dbsNorthwind.OpenRecordset( _
"Ten Most Expensive Products", dbOpenForwardOnly)
OpenRecordsetOutput rstTemp

Debug.Print "Opening read-only dynaset-type " & _
"recordset where the source is an SQL statement..."
Set rstTemp = dbsNorthwind.OpenRecordset( _
"SELECT * FROM Employees", dbOpenDynaset, dbReadOnly)
OpenRecordsetOutput rstTemp

' Use the Filter property to retrieve only certain
' records with the next OpenRecordset call.
Debug.Print "Opening recordset from existing " & _
"Recordset object to filter records..."
rstTemp.Filter = "LastName >= 'M'"
Set rstTemp2 = rstTemp.OpenRecordset()
OpenRecordsetOutput rstTemp2

Debug.Print "Opening dynamic-type recordset from " & _
"an ODBC connection..."
Set rstTemp = conPubs.OpenRecordset( _
"SELECT * FROM stores", dbOpenDynamic)
OpenRecordsetOutput rstTemp

' Use the StillExecuting property to determine when the
' Recordset is ready for manipulation.
Debug.Print "Opening snapshot-type recordset based " & _
"on asynchronous query to ODBC connection..."
Set rstTemp = conPubs.OpenRecordset("publishers", _
dbOpenSnapshot, dbRunAsync)
Do While rstTemp.StillExecuting
Debug.Print " [still executing...]"
Loop
OpenRecordsetOutput rstTemp

rstTemp.Close
dbsNorthwind.Close
conPubs.Close
wrkJet.Close
wrkODBC.Close

End Sub

Sub OpenRecordsetOutput(rstOutput As Recordset)

' Enumerate the specified Recordset object.
With rstOutput
Do While Not .EOF
Debug.Print , .Fields(0), .Fields(1)
.MoveNext
Loop
End With

End Sub

 
你用的系统是2000吧
我以前也出现过这个问题
怎么改也不行
最后我逐条记录读出
然后自己解释SQL语句,如果合适的就加入一个数组,我的办法太苯
看看别人有什么高明的办法没
 
这个和操作系统有关系吗?
我用的是XP,
我觉得如果是DAO的问题,在ACCESS里查询也应该溢出,否则一定是会有办法的
 
复合查询实际上是做了两个循环,可能就是因为这个耗资源吧
你用ACCESS查没问题,是不是你的程序选的驱动程序和ACCESS的不同?
你用的是ODBC? Jet?
 
DAO,应该和ACCESS一样
 
别忙了,看看话题435358、462524吧。
此题无解.
 
除非MS有问题,否则肯定有办法
 
[red]
现在一用LIKE就溢出,
select * from tbl_A where field_a like "*sohu*"
(field_a是255长的字符串类型)
而且在98下不会溢出
[/red]
 
试过ADO没,DAO有点老了,可能在新版本WIN下不太好使吧!
 
ADO应该是一样
 
告诉过你了,这是 Jet 数据库引擎的问题。它跟unicode字符集不兼容,
所以你只能等 MS 解决这个问题了.
 
为什么在ACCESS里查询就没事呢?
 
在 ACCESS 里有时候也会内存溢出,我遇到过。
总之这应该是个数据库引擎的 bug,无数人为此头破血流.
 
算了吧,我狠一点,一条一条的读
 
顶部