User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 391,917 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,710 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser:
Views: 12242 | Replies: 0
Reply
Join Date: Feb 2006
Posts: 8
Reputation: jcrcarmo is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jcrcarmo jcrcarmo is offline Offline
Newbie Poster

Question C# VS 2005 - SQL Query Parameters to an ODBC DataSource

  #1  
Mar 7th, 2006
Hello everyone,

I used to have my MS Access 2002 DataBase placed in my application folder and connect to it through an OLEDB connection. Everything worked fine.

Now I decided to create an ODBC DataSource and suddenly I'm not able to pass parameters to the SQL Query the way I used to with the OLEDB connection.

Here's a sample code of the SQL Query and C# code on my form:

FillByClienteDataNumero query:

SELECT Data, Cliente, Tipo, Número, Espécie, Lote, Análise, Preço 
FROM qryALL1 
WHERE (Cliente = ?) AND (Data >= ?) AND (Data <= ?) AND (Tipo = ?) 
ORDER BY Data, Número 

Form code:

private void btnSeekBA_Click(object sender, EventArgs e) 
{ 
try 
{ 
this.qryALL1TableAdapter.FillByClienteDataTipo(this.sascrDataSet.qryALL1, cbCliente.Text, new System.Nullable<System.DateTime>(((System.DateTime)(System.Convert.ChangeType(DataIni.Text, typeof(System.DateTime))))), new System.Nullable<System.DateTime>(((System.DateTime)(System.Convert.ChangeType(DataFin.Text, typeof(System.DateTime))))), "Boletim"); 
} 
catch (System.Exception ex) 
{ 
System.Windows.Forms.MessageBox.Show(ex.Message); 
} 
} 

Any ideas why the above SQL query and code work with an OLEDB connection but not with an ODBC DataSource? Thanks a million!

JC.
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 2 (0 members and 2 guests)

 

DaniWeb C# Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C# Forum

All times are GMT -4. The time now is 8:10 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC