[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

attempted two active database requests

Elmar Rieke

9/30/2002 9:31:00 PM

Hi NG.
I'm working with a Sybase Anywhere 5.5x Database,
connectet with ODBC.NET
If i send requests to the database in a loop, so verry
fast, i get after a while this error-message from ODBC-
driver

ERROR [HY000] [Sybase][ODBC Driver]General error:
attempted two active database requests

It seems, that the progam is not waiting until the
OdbcDataReader is realy closed. I tryed it with "Do Until
rsPat.IsClosed; Loop" but it has no effect.
Thanks for every good idea

I made it in this way (VB.NET)

Dim dbPat As New Microsoft.Data.Odbc.OdbcConnection
("DSN=Pat; UID=xxxxx; PWD=yyyyyy")
dbPat.Open()
Dim rsPat As Microsoft.Data.Odbc.OdbcDataReader
Dim sql As String
Dim Fnr as Integer
for Fnr = 1 to 300
sql = "select * FROM dba.fall where No = " & Fnr
Try
Dim cmd As New Microsoft.Data.Odbc.OdbcCommand
(sql, dbPat)
rsPat = cmd.ExecuteReader()
While rsPat.Read()
Console.Write(Fnr & " - " &
rsPat.Item("No") & vbCrLf)
end while
Catch e As Exception
MsgBox(e.Message)
Finally
rsPat.Close()
End Try
next Fnr
dbPat.close()