Cannot open any more Tables
-
Hi all, I have a page which works fine on my local computer, but when I upload it to my server it gives the following error. Can any one tell me the reason of that error and possible solution for that. System.Data.OleDb.OleDbException: Cannot open any more tables. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.OleDb.OleDbCommand.ExecuteReader() at cust_order.custOrdDes() in c:\domains\etradehouse.com\wwwroot\code\adm\cust_det\adm_order_det.aspx.vb:line 2090 and the code of that sub is given belown Public Sub custOrd() customerAsc.Clear() customer.Clear() Try If Conn.State <> 0 Then Conn.Close() End If Conn.Open() SelectQuery = "select order_id from cust_order" command = New OleDbCommand(SelectQuery, Conn) total = command.ExecuteReader() While total.Read ordAsc.Add(total.GetValue(0)) End While Dim i As Integer For i = 0 To ordAsc.Count - 1 SelectQuery = "SELECT customers.customer_id,customers.customer_type FROM customers INNER JOIN cust_order ON customers.customer_id=cust_order.customer_id WHERE cust_order.order_id=" & ordAsc(i) & "" command = New OleDbCommand(SelectQuery, Conn) total = command.ExecuteReader() While total.Read() cstAsc.Add(total.GetValue(0)) typAsc.Add(total.GetValue(1)) End While Next total.Close() total = Nothing Dim k As Integer For k = 0 To cstAsc.Count - 1 If typAsc(k) = 1 Then SelectQuery = "Select comp_name, customer_id from biz_cust_extra where customer_id = " & cstAsc(k) command = New OleDbCommand(SelectQuery, Conn) total = command.ExecuteReader() While total.Read() If Not total.IsDBNull(0) Then customerAsc.Add(tot
-
Hi all, I have a page which works fine on my local computer, but when I upload it to my server it gives the following error. Can any one tell me the reason of that error and possible solution for that. System.Data.OleDb.OleDbException: Cannot open any more tables. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.OleDb.OleDbCommand.ExecuteReader() at cust_order.custOrdDes() in c:\domains\etradehouse.com\wwwroot\code\adm\cust_det\adm_order_det.aspx.vb:line 2090 and the code of that sub is given belown Public Sub custOrd() customerAsc.Clear() customer.Clear() Try If Conn.State <> 0 Then Conn.Close() End If Conn.Open() SelectQuery = "select order_id from cust_order" command = New OleDbCommand(SelectQuery, Conn) total = command.ExecuteReader() While total.Read ordAsc.Add(total.GetValue(0)) End While Dim i As Integer For i = 0 To ordAsc.Count - 1 SelectQuery = "SELECT customers.customer_id,customers.customer_type FROM customers INNER JOIN cust_order ON customers.customer_id=cust_order.customer_id WHERE cust_order.order_id=" & ordAsc(i) & "" command = New OleDbCommand(SelectQuery, Conn) total = command.ExecuteReader() While total.Read() cstAsc.Add(total.GetValue(0)) typAsc.Add(total.GetValue(1)) End While Next total.Close() total = Nothing Dim k As Integer For k = 0 To cstAsc.Count - 1 If typAsc(k) = 1 Then SelectQuery = "Select comp_name, customer_id from biz_cust_extra where customer_id = " & cstAsc(k) command = New OleDbCommand(SelectQuery, Conn) total = command.ExecuteReader() While total.Read() If Not total.IsDBNull(0) Then customerAsc.Add(tot
-
I see you havnt closed your reader 'total' after the first query. try, total.Close()
Mubashir Software Architect Storan Technologies Inc, USA Every job is a self portrait of the person who did it.
Now I close it but it still gives the same error. Can u tell me what is the reason and possible solution for that.
-
Now I close it but it still gives the same error. Can u tell me what is the reason and possible solution for that.
OK, see this
For i = 0 To ordAsc.Count - 1 SelectQuery = "SELECT customers.customer_id,customers.customer_type FROM customers INNER JOIN cust_order ON customers.customer_id=cust_order.customer_id WHERE cust_order.order_id=" & ordAsc(i) & "" command = New OleDbCommand(SelectQuery, Conn) total = command.ExecuteReader() While total.Read() cstAsc.Add(total.GetValue(0)) typAsc.Add(total.GetValue(1)) End While Next
Here you are looping thru some list and executing reader without closing it. That is why it is throwing exception. Make sure you close the reader after you finish fetching records.
Mubashir Software Architect Storan Technologies Inc, USA Every job is a self portrait of the person who did it.
-
OK, see this
For i = 0 To ordAsc.Count - 1 SelectQuery = "SELECT customers.customer_id,customers.customer_type FROM customers INNER JOIN cust_order ON customers.customer_id=cust_order.customer_id WHERE cust_order.order_id=" & ordAsc(i) & "" command = New OleDbCommand(SelectQuery, Conn) total = command.ExecuteReader() While total.Read() cstAsc.Add(total.GetValue(0)) typAsc.Add(total.GetValue(1)) End While Next
Here you are looping thru some list and executing reader without closing it. That is why it is throwing exception. Make sure you close the reader after you finish fetching records.
Mubashir Software Architect Storan Technologies Inc, USA Every job is a self portrait of the person who did it.
Can u pls tell me where should i close reader in my code. I m new to programming so why i m facig problems.
-
Can u pls tell me where should i close reader in my code. I m new to programming so why i m facig problems.
Sure..
For i = 0 To ordAsc.Count - 1 SelectQuery = "SELECT customers.customer_id,customers.customer_type FROM customers INNER JOIN cust_order ON customers.customer_id=cust_order.customer_id WHERE cust_order.order_id=" & ordAsc(i) & "" command = New OleDbCommand(SelectQuery, Conn) total = command.ExecuteReader() While total.Read() cstAsc.Add(total.GetValue(0)) typAsc.Add(total.GetValue(1)) End While total.Close() '<--- Next
See above, right after the while loop. I see you have the same mistake in all your code. Fix them with the same
Mubashir Software Architect Storan Technologies Inc, USA Every job is a self portrait of the person who did it.
-
Sure..
For i = 0 To ordAsc.Count - 1 SelectQuery = "SELECT customers.customer_id,customers.customer_type FROM customers INNER JOIN cust_order ON customers.customer_id=cust_order.customer_id WHERE cust_order.order_id=" & ordAsc(i) & "" command = New OleDbCommand(SelectQuery, Conn) total = command.ExecuteReader() While total.Read() cstAsc.Add(total.GetValue(0)) typAsc.Add(total.GetValue(1)) End While total.Close() '<--- Next
See above, right after the while loop. I see you have the same mistake in all your code. Fix them with the same
Mubashir Software Architect Storan Technologies Inc, USA Every job is a self portrait of the person who did it.
I have done according to ur answer but now another problem occured and following error occured. The page cannot be displayed The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings
-
I have done according to ur answer but now another problem occured and following error occured. The page cannot be displayed The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings
Good, so you are out of one problem. Now it seems like your program stuck into a never ending loop. It is a typical logical error, try debugging your code.
Mubashir Software Architect Storan Technologies Inc, USA Every job is a self portrait of the person who did it.
-
Good, so you are out of one problem. Now it seems like your program stuck into a never ending loop. It is a typical logical error, try debugging your code.
Mubashir Software Architect Storan Technologies Inc, USA Every job is a self portrait of the person who did it.
Thank u very much dear. Now I will find out what is the error. I think u r Pakistani. I m also Pakistani. My name is Arif Bangash. And I m new to programming. Will u help me in making myself a good programmer. Can u pls give me ur email address with help of which I can contact u.
-
Thank u very much dear. Now I will find out what is the error. I think u r Pakistani. I m also Pakistani. My name is Arif Bangash. And I m new to programming. Will u help me in making myself a good programmer. Can u pls give me ur email address with help of which I can contact u.
Yea I am a proud Paki ;) you can find me on mubashir01@hotmail.com regards,
Mubashir Software Architect Storan Technologies Inc, USA Every job is a self portrait of the person who did it.