Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old November 4th, 2003, 04:20 AM
tomgtt tomgtt is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 14 tomgtt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
.NET Error: FbCommand is currently busy Open,

Hi,

I'm getting this error: FbCommand is currently busy Open,
Fetching.
when I'm trying to run this code:

cnn.Open();
FbTransaction trans = cnn.BeginTransaction();
cmd = new FbCommand("SELECT USER_PASSWORD FROM USERS WHERE USER_NAME='" +
uid + "'",cnn,trans);
dr = cmd.ExecuteReader();
trans.Commit();
cnn.Close();

Anybody got an idea what i'm doing wrong?

Reply With Quote
  #2  
Old November 4th, 2003, 01:15 PM
carlosga carlosga is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 13 carlosga User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hello:

try closing the FbDataReader:

cnn.Open();
FbTransaction trans = cnn.BeginTransaction();
cmd = new FbCommand("SELECT USER_PASSWORD FROM USERS WHERE USER_NAME='" +
uid + "'",cnn,trans);
dr = cmd.ExecuteReader();
dr.Close(); <---------------
trans.Commit();
cnn.Close();



--
Best regards

Carlos GuzmánÁlvarez
Vigo-Spain

Reply With Quote
  #3  
Old November 4th, 2003, 01:24 PM
tomgtt tomgtt is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 14 tomgtt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
If i do this i'm getting:

FirebirdSql.Data.Firebird.Gds.GdsException: Exception of type FirebirdSql.Data.Firebird.Gds.GdsException was thrown.

as I'm trying to access the DataReader later

Last edited by tomgtt : November 4th, 2003 at 01:27 PM.

Reply With Quote
  #4  
Old November 4th, 2003, 01:33 PM
carlosga carlosga is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 13 carlosga User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hello:

It's working fine for me, here is my test code:

FbConnection connection = new FbConnection(connectionString);
connection.Open();

FbTransaction transaction = connection.BeginTransaction();
FbCommand command = new FbCommand("SELECT INT_FIELD FROM TEST_TABLE_01", connection, transaction);
FbDataReader dr = command.ExecuteReader();
dr.Close();

transaction.Commit();
connection.Close();


Which version of the .NET provider are you using ??

Reply With Quote
  #5  
Old November 4th, 2003, 01:35 PM
tomgtt tomgtt is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 14 tomgtt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ya it works fine if you do it your way but with this piece here it gives me the error:

cnn.Open();
FbTransaction trans = cnn.BeginTransaction();
cmd = new FbCommand("SELECT USER_PASSWORD FROM USERS WHERE USER_NAME='" + uid + "'",cnn,trans);
dr = cmd.ExecuteReader();
trans.Commit();
while(dr.Read())
{
if (string.Compare(dr["USER_PASSWORD"].ToString(),passwd,false)==0)
{
cnn.Close();
return true;
}
}
dr.Close();

Reply With Quote
  #6  
Old November 4th, 2003, 01:48 PM
tomgtt tomgtt is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 14 tomgtt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
coming from a MySql background this .Commit() is confusing me?
What is it acutally doing?

Reply With Quote
  #7  
Old November 4th, 2003, 02:53 PM
carlosga carlosga is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 13 carlosga User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hello:

>ya it works fine if you do it your way but
>with this piece here it gives me the error:

Because you can't make a Commit with an open datareader, try this:

cnn.Open();
FbTransaction trans = cnn.BeginTransaction();
cmd = new FbCommand("SELECT USER_PASSWORD FROM USERS WHERE USER_NAME='" + uid + "'",cnn,trans);
dr = cmd.ExecuteReader();
while(dr.Read())
{
if (string.Compare(dr["USER_PASSWORD"].ToString(),passwd,false)==0)
{
cnn.Close();
return true;
}
}
trans.Commit();
dr.Close();

If you are using version 1.5 of the .NET Data Provider you can make this:

cnn.Open();
cmd = new FbCommand("SELECT USER_PASSWORD FROM USERS WHERE USER_NAME='" + uid + "'",cnn);
dr = cmd.ExecuteReader();
while(dr.Read())
{
if (string.Compare(dr["USER_PASSWORD"].ToString(),passwd,false)==0)
{
cnn.Close();
return true;
}
}
dr.Close();

Reply With Quote
  #8  
Old November 4th, 2003, 03:01 PM
tomgtt tomgtt is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 14 tomgtt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i have the 1.5 b3

is there no .Commit() neccessary at your 2nd version?

This way I'm getting no error message anymore but it's not doing what it used to do with mysql


also you left out the trans in this cmd: cmd = new FbCommand("SELECT USER_PASSWORD FROM USERS WHERE USER_NAME='" + uid + "'",cnn);

on purpose or just an error? If I do it this way I get an error

Last edited by tomgtt : November 4th, 2003 at 03:09 PM.

Reply With Quote
  #9  
Old November 4th, 2003, 03:41 PM
tomgtt tomgtt is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 14 tomgtt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hah, I finally figured out the problem. My connection string when the variable is passed looks like:

SELECT user_password FROM users WHERE user_name='fname.lname@email.com"

There seems to be an error with the '@' because when i remove it it works. Any way around that?

Reply With Quote
  #10  
Old November 4th, 2003, 05:03 PM
carlosga carlosga is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 13 carlosga User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>There seems to be an error with the '@' because when i remove it it works. Any way around that?


At this moment only using parameters, this is a problem with the named parameters support.

Reply With Quote
  #11  
Old November 4th, 2003, 05:07 PM
tomgtt tomgtt is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 14 tomgtt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
do you know of any workaround? because i'm using the login names from our email server which are stored in the same database and can't use anything else.

Reply With Quote
  #12  
Old November 5th, 2003, 03:24 AM
carlosga carlosga is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 13 carlosga User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hello:

As i tell before using parameters:

...

cmd = new FbCommand("SELECT USER_PASSWORD FROM USERS WHERE USER_NAME=@user_name",cnn,trans);

cmd.Parameters.Add("@user_name", FbDbType.VarChar).Value = uid;

....

or

...

cmd = new FbCommand("SELECT USER_PASSWORD FROM USERS WHERE USER_NAME=?",cnn,trans);

cmd.Parameters.Add("@user_name", FbDbType.VarChar).Value = uid;

....

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > .NET Error: FbCommand is currently busy Open,


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway