Re: Recordset problem....
Alireza Kheyrollahi <[email protected]> Thu, 15 May 2003 18:59:59 +0100
| Newsgroups | gmane.comp.windows.devel.vbcom |
|---|---|
| Message-ID | <001701c31b0b$d683d4e0$555568d5@aliostad> |
This is a multi-part message in MIME format.
------=_NextPart_000_0014_01C31B14.2F158060
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
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 =3D "Provider=3DMicrosoft.Jet.Oledb.4.0;Data =
Source=3Dc:\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 =3D rs.clone instead of =
Set SelectData =3D 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.=20
Hope this helps.
Ali
----- Original Message -----=20
From: "Salai Sivadhanam" <[email protected]>
To: <[email protected]>
Sent: Thursday, May 15, 2003 11:23 AM
Subject: Re: [VBCOM] Recordset problem....
Hello Mr. Alireza Kheyrollahi....=20
Here is the function which will get the insert query and processes...=20
Public Function changedata(sqlstr As String) As String
On Error goto errHandler
changedata =3D ""
objCon.Execute sqlstr
changedata =3D kStrMsgSuccess
errHandler:
If Err.Number <> 0 Then
changedata =3D 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....=20
Public Function SelectData(sqlstr As String) As Recordset
On Error goto errHandler
Dim rs As New ADODB.Recordset=20
rs.CursorLocation =3D adUseClient
rs.Open sqlstr, objCon, adOpenStatic, adLockReadOnly =20
Set SelectData =3D rs
ErrHandler:
If Err.Number <> 0 Then
Set SelectData =3D 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....=20
Salai
-----Original Message-----
From: Technical discussion of VBCOM [mailto:[email protected]]On =
Behalf Of Alireza Kheyrollahi
Sent: Thursday, May 15, 2003 4:08 AM
To: [email protected]
Subject: Re: [VBCOM] Recordset problem....
Always include a snippet of your code. Have you set CursorLocation to
adUseClient?
----- Original Message -----
From: "Salai Sivadhanam" <[email protected]>
To: <[email protected]>
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.
------=_NextPart_000_0014_01C31B14.2F158060
Content-Type: text/html;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DVerdana color=3D#000080 size=3D2>Hi =
Salai,</FONT></DIV>
<DIV><FONT face=3DVerdana color=3D#000080 size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana color=3D#000080 size=3D2>It is so typical of =
problems from=20
CursorLocation being adUseServer or adUsNone. What I believe might help =
is that=20
try to log properties like recordcount (which I bet will be -1 because =
cursor=20
location is not right) and aslo cursor location in case you get any =
error. I=20
would also think of using another locking option like optimistic for no=20
particular reason!</FONT></DIV>
<DIV><FONT face=3DVerdana color=3D#000080 size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana color=3D#000080 size=3D2>Another thing is that =
I wonder why=20
you do not use OLEDB instead of ODBC? It is faster and more reliable and =
you=20
just have to change connection string which is not a major =
change:</FONT></DIV>
<DIV><FONT face=3DVerdana color=3D#000080 size=3D2>cn.ConnectionString =
=3D=20
"Provider=3DMicrosoft.Jet.Oledb.4.0;Data =
Source=3Dc:\myDb.mdb"</FONT></DIV>
<DIV><FONT face=3DVerdana color=3D#000080 size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana color=3D#000080 size=3D2>One of the things I =
am very much=20
suspect of is returning recordsets as return value of functions. I =
have=20
seen strange things when recordset has been moving around. Try to use =
<FONT=20
color=3D#000000>Set SelectData =3D </FONT>rs.clone instead of <FONT =
color=3D#000000>Set SelectData =3D rs and see if it would =
help.</FONT></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana color=3D#000080 size=3D2>The other =
solution might be=20
adding the record to the same recodset and then using the same routine. =
I=20
mean using addnew and then update. </FONT></DIV>
<DIV><FONT face=3DVerdana color=3D#000080 size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana color=3D#000080 size=3D2>Hope this =
helps.</FONT></DIV>
<DIV><FONT face=3DVerdana color=3D#000080 size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana color=3D#000080 size=3D2>Ali</DIV>
<DIV><BR></DIV></FONT>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana size=3D2>----- Original Message ----- =
</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2>From: "Salai Sivadhanam" =
<</FONT><A=20
href=3D"mailto:[email protected]"><FONT face=3DVerdana =
color=3D#000000=20
size=3D2>[email protected]</FONT></A><FONT face=3DVerdana=20
size=3D2>></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2>To: <</FONT><A=20
href=3D"mailto:[email protected]"><FONT face=3DVerdana =
color=3D#000000=20
size=3D2>[email protected]</FONT></A><FONT face=3DVerdana=20
size=3D2>></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2>Sent: Thursday, May 15, 2003 11:23=20
AM</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2>Subject: Re: [VBCOM] Recordset=20
problem....</FONT></DIV>
<DIV><FONT face=3DVerdana><BR><FONT size=3D2></FONT></FONT></DIV><FONT =
face=3DVerdana=20
size=3D2>Hello Mr. Alireza Kheyrollahi.... <BR><BR>Here is the function =
which will=20
get the insert query and processes... <BR><BR>Public Function =
changedata(sqlstr=20
As String) As String<BR>On Error goto=20
errHandler<BR> changedata =3D=20
""<BR> objCon.Execute=20
sqlstr<BR> changedata =3D=20
kStrMsgSuccess<BR>errHandler:<BR>If Err.Number <> 0=20
Then<BR> changedata =3D Err.Number & " : " &=20
Err.Description<BR>End If<BR>End Function<BR><BR>And, Here is my another =
function which will get select query as parameter and will return =
the=20
recordset.... <BR><BR>Public Function SelectData(sqlstr As String) As=20
Recordset<BR>On Error goto=20
errHandler<BR> Dim rs As New=20
ADODB.Recordset <BR>rs.CursorLocation =3D=20
adUseClient<BR> rs.Open =
sqlstr,=20
objCon, adOpenStatic, adLockReadOnly =20
<BR> Set SelectData =3D=20
rs<BR>ErrHandler:<BR>If Err.Number <> 0 Then<BR> =
Set=20
SelectData =3D Nothing<BR>End If<BR>End Function<BR><BR>Then also, the =
problem is=20
coming.... It's failing to select the record immediately after =
submitting the=20
data.... I am getting "[Microsoft][ODBC Microsoft Access Driver] Not a =
valid=20
bookmark." error.... How to solve this problem....=20
<BR><BR>Salai<BR><BR>-----Original Message-----<BR>From: Technical =
discussion of=20
VBCOM [mailto:[email protected]]On Behalf Of Alireza=20
Kheyrollahi<BR>Sent: Thursday, May 15, 2003 4:08 AM<BR>To: </FONT><A=20
href=3D"mailto:[email protected]"><FONT face=3DVerdana =
color=3D#000000=20
size=3D2>[email protected]</FONT></A><BR><FONT face=3DVerdana=20
size=3D2>Subject: Re: [VBCOM] Recordset problem....<BR><BR>Always =
include a=20
snippet of your code. Have you set CursorLocation=20
to<BR>adUseClient?<BR><BR><BR>----- Original Message -----<BR>From: =
"Salai=20
Sivadhanam" <</FONT><A href=3D"mailto:[email protected]"><FONT =
face=3DVerdana color=3D#000000 =
size=3D2>[email protected]</FONT></A><FONT=20
face=3DVerdana size=3D2>><BR>To: <</FONT><A=20
href=3D"mailto:[email protected]"><FONT face=3DVerdana =
color=3D#000000=20
size=3D2>[email protected]</FONT></A><FONT face=3DVerdana=20
size=3D2>><BR>Sent: Wednesday, May 07, 2003 2:22 PM<BR>Subject: =
[VBCOM]=20
Recordset problem....<BR><BR><BR>Hi All....<BR><BR>I am using VBCOM =
component to=20
deal with the database, and I am using MS<BR>Access for my project.... I =
am=20
fetching the records in a recordset which is<BR>created within a=20
DLL....<BR><BR>Sometime, I am submitting a record into DB, and, =
immediately I am=20
trying to<BR>retrieve that record.... At that time, my DLL is returning =
nothing,=20
but not<BR>a recordset.... But, if I do slowly, or in a debug mode, it's =
fetching<BR>properly and returning the recordset without any problem.... =
How to=20
overcome<BR>this problem....? Will anyone suggest=20
me....??<BR><BR>Salai<BR><BR>You can read messages from the VBCOM =
archive,=20
unsubscribe from VBCOM, or<BR>subscribe to other DevelopMentor lists at=20
</FONT><A href=3D"http://discuss.develop.com"><FONT face=3DVerdana =
color=3D#000000=20
size=3D2>http://discuss.develop.com</FONT></A><FONT face=3DVerdana=20
size=3D2>.<BR><BR>You can read messages from the VBCOM archive, =
unsubscribe from=20
VBCOM, or<BR>subscribe to other DevelopMentor lists at </FONT><A=20
href=3D"http://discuss.develop.com"><FONT face=3DVerdana color=3D#000000 =
size=3D2>http://discuss.develop.com</FONT></A><FONT face=3DVerdana=20
size=3D2>.<BR><BR>You can read messages from the VBCOM archive, =
unsubscribe from=20
VBCOM, or<BR>subscribe to other DevelopMentor lists at </FONT><A=20
href=3D"http://discuss.develop.com"><FONT face=3DVerdana color=3D#000000 =
size=3D2>http://discuss.develop.com</FONT></A><FONT face=3DVerdana=20
size=3D2>.<BR></FONT></BODY></HTML>
You can read messages from the VBCOM archive, unsubscribe from VBCOM, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
------=_NextPart_000_0014_01C31B14.2F158060--