943,791 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 20464
  • C# RSS
Mar 8th, 2006
0

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

Expand Post »
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:

C# Syntax (Toggle Plain Text)
  1. SELECT Data, Cliente, Tipo, Número, Espécie, Lote, Análise, Preço
  2. FROM qryALL1
  3. WHERE (Cliente = ?) AND (Data >= ?) AND (Data <= ?) AND (Tipo = ?)
  4. ORDER BY Data, Número

Form code:

C# Syntax (Toggle Plain Text)
  1. private void btnSeekBA_Click(object sender, EventArgs e)
  2. {
  3. try
  4. {
  5. 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");
  6. }
  7. catch (System.Exception ex)
  8. {
  9. System.Windows.Forms.MessageBox.Show(ex.Message);
  10. }
  11. }

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

JC.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jcrcarmo is offline Offline
8 posts
since Feb 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Datagrid
Next Thread in C# Forum Timeline: Calling function in a child window from main parent window





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC