DotNet and Firebird Embedded: Prolem with distinct clause

O

osmarjunior

Hi. I made a method to execute queries in my database (Firebird
embedded v.1.5.3).
The Database class contains methods to create the database specific
objects.

public static DbDataReader ExecuteReader(String query)
{
// Creates the DbCommand
DbCommand command = Database.GetCommand();

// Creates the DbConnection and open it
command.Connection = Database.GetConnection();

// Obtains the SQL query text
command.CommandText = query;

// Execute the query and return the DataReader
return command.ExecuteReader(CommandBehavior.CloseConnection);
}

At first, all the queries runs ok, except if I use the distinct clause.
The following query works perfectly:

"SELECT unity FROM products"

The following query does not work, and the method ExecuteReader crashes
(like being processing something, and never leaves the scope):

"SELECT DISTINCT(unity) FROM products"

Any idea what it can be?

Regards.

Junior.
 
J

Jani Järvinen [MVP]

Hi Junior,
The following query does not work, and the method ExecuteReader crashes
(like being processing something, and never leaves the scope):
"SELECT DISTINCT(unity) FROM products"

I haven't used Firebird (though I have used InterBase), but shouldn't your
SELECT statement be:

"SELECT DISTINCT unity FROM products"

I.e. DISTINCT is not a function but a keyword. Check your SQL reference if
this is the case. If this doesn't help, then we would need the error message
given by ExecuteReader().

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
(e-mail address removed)
http://www.saunalahti.fi/janij/
 
O

osmarjunior

Hi. The statement is correct. I've made a test in the EMS SQL Manager
tool and it works. But when executing the statement inside the .Net
doesn't work. And there's no error message, the application just keeps
"stuck"... and must shutdown with Ctrl+Alt+Del... and the ExecuteReader
method that is crashing the application, and I don't know why...

Thanks.

Junior

Jani Järvinen [MVP] escreveu:
 
O

osmarjunior

Hello again. I discovered that is a problem related to the embedded
version of Firebird.
I made a test with the server version of Firebird, and it works now.

Thanks for your time.

Junior

osmarjunior escreveu:
 
J

Jani Järvinen [MVP]

Hi Junior,

I'm glad to hear you got it working.

By the way, be sure to check out the new InterBase 2007, should be more
robust than Firebird.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
(e-mail address removed)
http://www.saunalahti.fi/janij/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top