473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

DotNet and Firebird Embedded: Prolem with distinct clause


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.CloseConnect ion);
}

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.

Oct 21 '06 #1
4 4218
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
ja***@removethis.dystopia.fi
http://www.saunalahti.fi/janij/
Oct 21 '06 #2

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:
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
ja***@removethis.dystopia.fi
http://www.saunalahti.fi/janij/
Oct 21 '06 #3

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:
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:
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 referenceif
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
ja***@removethis.dystopia.fi
http://www.saunalahti.fi/janij/
Oct 21 '06 #4
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
ja***@removethis.dystopia.fi
http://www.saunalahti.fi/janij/
Oct 22 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ralph Freshour | last post by:
I have a question about the following PHP script - I got it off a web site tutorial on how to count users logged into your site - my question is the $PHP_SELF variable - it writes the name of the...
3
by: Jacek | last post by:
Hi, can anyone shed some light on this issue? SELECT Status from lupStatus with a normal query it returns the correct recordcount SELECT Status from lupStatus GROUP BY Status but with a GROUP...
1
by: Alex Satrapa | last post by:
I have a table from which I'm trying to extract certain information. For historical reasons, we archive every action on a particular thing ('thing' is identified, funnily enough, by 'id'). So the...
18
by: mathilda | last post by:
My boss has been adamant that SELECT DISTINCT is a faster query than SELECT all other factors being equal. I disagree. We are linking an Access front end to a SQL Server back end and normally are...
6
by: www.FreelanZ.nl | last post by:
I am trying to get the embedded Firebird database in my VB.NET app. I already have the dll, but i can't get it running.. Has anyone an example for me ? This would help a lot. Can't find any on...
0
by: Ann Harrison | last post by:
Tom, Actually, I've never had a corrupted firebird database. There were two bugs in an older version of InterBase that produced income for me. The first was a failure to realize that a file had...
12
by: timothy.williams | last post by:
Hi. I have a Python program that parses a file and inserts records into a database with MySQLdb. I recently upgraded to MySQL 5.0.8, and now my parser runs *really* slow. Writing out to CSV...
6
by: Bob Stearns | last post by:
I am getting unwanted duplicate rows in my result set, so I added the DISTINCT keyword to my outermost SELECT. My working query then returned the following message: DB2 SQL error: SQLCODE: -214,...
2
by: Krish | last post by:
Hi I am validating using the firebird Embedded DB with .NET. has anyone used it with .NET and would like to share his/her experiences about the same? Kris
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.