Hi Salai,
It is so typical of problems from CursorLocation being adUseServer or adUsNone. What I believe might help is that try to log properties like recordcount (which I bet will be -1 because cursor location is not right) and aslo cursor location in case you get any error. I would also think of using another locking option like optimistic for no particular reason!
Another thing is that I wonder why you do not use OLEDB instead of ODBC? It is faster and more reliable and you just have to change connection string which is not a major change:
cn.ConnectionString = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=c:\myDb.mdb"
One of the things I am very much suspect of is returning recordsets as return value of functions. I have seen strange things when recordset has been moving around. Try to use Set SelectData = rs.clone instead of Set SelectData = rs and see if it would help.
The other solution might be adding the record to the same recodset and then using the same routine. I mean using addnew and then update.
Hope this helps.
Ali
----- Original Message -----
From: "Salai Sivadhanam" <***@LGSOFTINDIA.COM>
To: <***@DISCUSS.DEVELOP.COM>
Sent: Thursday, May 15, 2003 11:23 AM
Subject: Re: [VBCOM] Recordset problem....
Hello Mr. Alireza Kheyrollahi....
Here is the function which will get the insert query and processes...
Public Function changedata(sqlstr As String) As String
On Error goto errHandler
changedata = ""
objCon.Execute sqlstr
changedata = kStrMsgSuccess
errHandler:
If Err.Number <> 0 Then
changedata = Err.Number & " : " & Err.Description
End If
End Function
And, Here is my another function which will get select query as parameter and will return the recordset....
Public Function SelectData(sqlstr As String) As Recordset
On Error goto errHandler
Dim rs As New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open sqlstr, objCon, adOpenStatic, adLockReadOnly
Set SelectData = rs
ErrHandler:
If Err.Number <> 0 Then
Set SelectData = Nothing
End If
End Function
Then also, the problem is coming.... It's failing to select the record immediately after submitting the data.... I am getting "[Microsoft][ODBC Microsoft Access Driver] Not a valid bookmark." error.... How to solve this problem....
Salai
-----Original Message-----
From: Technical discussion of VBCOM [mailto:***@DISCUSS.DEVELOP.COM]On Behalf Of Alireza Kheyrollahi
Sent: Thursday, May 15, 2003 4:08 AM
To: ***@DISCUSS.DEVELOP.COM
Subject: Re: [VBCOM] Recordset problem....
Always include a snippet of your code. Have you set CursorLocation to
adUseClient?
----- Original Message -----
From: "Salai Sivadhanam" <***@LGSOFTINDIA.COM>
To: <***@DISCUSS.DEVELOP.COM>
Sent: Wednesday, May 07, 2003 2:22 PM
Subject: [VBCOM] Recordset problem....
Hi All....
I am using VBCOM component to deal with the database, and I am using MS
Access for my project.... I am fetching the records in a recordset which is
created within a DLL....
Sometime, I am submitting a record into DB, and, immediately I am trying to
retrieve that record.... At that time, my DLL is returning nothing, but not
a recordset.... But, if I do slowly, or in a debug mode, it's fetching
properly and returning the recordset without any problem.... How to overcome
this problem....? Will anyone suggest me....??
Salai
You can read messages from the VBCOM archive, unsubscribe from VBCOM, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
You can read messages from the VBCOM archive, unsubscribe from VBCOM, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
You can read messages from the VBCOM archive, unsubscribe from VBCOM, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
You can read messages from the VBCOM archive, unsubscribe from VBCOM, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.