469,331 Members | 6,053 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,331 developers. It's quick & easy.

The OleDbCommand is currently busy Open,fetching

6
hi
i am getting an error like The OleDbCommand is currently busy Open, Fetching.
code:
Expand|Select|Wrap|Line Numbers
  1. Dim book1(80) As Integer
  2.         Dim mem1(120) As Integer
  3.         Dim twod(80)() As Integer
  4.         Dim i%, k%, l%, j%
  5.         Dim Rdr1 As OleDb.OleDbDataReader
  6.         Dim Rdr2 As OleDb.OleDbDataReader
  7.         For i = 100 To 180 Step 1
  8.          OleDbConnection1.Open()
  9.             OleDbDataAdapter1.SelectCommand.CommandText = "SELECT memberid FROM histo WHERE id=" & i & " "
  10.             Rdr1 = OleDbSelectCommand1.ExecuteReader()
  11.             j = 0
  12.             While Rdr1.Read
  13.                 mem1(j) = Rdr1.GetValue(0)
  14.                 j += 1
  15.             End While
  16.             Rdr1.Close()
  17.             For k = 0 To UBound(mem1) Step 1
  18.                OleDbDataAdapter1.SelectCommand.CommandText = "SELECT id FROM histo1 WHERE memberid=" & k & " "
  19.                 Rdr2 = OleDbDataAdapter1.SelectCommand.ExecuteReader
  20.                 l = 0
  21.                 While Rdr2.Read
  22.                     mem1(l) = Rdr2.GetValue(0)
  23.                     l += 1
  24.                 End While
  25.                 'Console.Write(mem1(k))
  26.             Next k
  27.             'Console.Write(book1(i))
  28.         Next i
thanks
ramya
Mar 7 '07 #1
3 2506
kenobewan
4,871 Expert 4TB
First step is to change your select command, try:
Expand|Select|Wrap|Line Numbers
  1. OleDbDataAdapter1.SelectCommand.CommandText = "SELECT memberid FROM histo WHERE id='" & i & "'"
Here is an article that may help:
Using Parameterized Query in ASP.NET
Mar 8 '07 #2
ramyan
6
but then my id is an integer.i tried its datatype mismatch
Mar 8 '07 #3
Have you pasted the exact code from your editor?
your first reader is
Rdr1 = OleDbSelectCommand1.ExecuteReader()
and the second reader is
Rdr2 = OleDbDataAdapter1.SelectCommand.ExecuteReader

Instead of creating datareaders directly from the Adapter, why dont you create a command object and then get the DataReader from it. I mean to say that you try using the 1st method for both the DataReaders, Rdr1, and Rdr2.
Mar 8 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by jerim | last post: by
2 posts views Thread by Christopher | last post: by
1 post views Thread by marc.gibian | last post: by
4 posts views Thread by Agnes | last post: by
5 posts views Thread by =?Utf-8?B?bXVzb3NkZXY=?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by haryvincent176 | last post: by
reply views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.