| | |
C# VS 2005 - SQL Query Parameters to an ODBC DataSource
Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Feb 2006
Posts: 8
Reputation:
Solved Threads: 0
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:
Form code:
Any ideas why the above SQL query and code work with an OLEDB connection but not with an ODBC DataSource? Thanks a million!
JC.
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)
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:
C# Syntax (Toggle Plain Text)
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.
![]() |
Similar Threads
- sql query problem with MS Access and C# (C#)
- sql query updating problem (Visual Basic 4 / 5 / 6)
- Javascript array from sql query (JSP)
- Please help me out with MySQL query (MySQL)
- PHP/SQL query help (PHP)
- Change Query Parameters (MS Access and FileMaker Pro)
- Retreiving variables from a sql query into a form (PHP)
Other Threads in the C# Forum
- Previous Thread: Datagrid
- Next Thread: Calling function in a child window from main parent window
| Thread Tools | Search this Thread |
.net access algorithm array asp.net bitmap box broadcast c# check checkbox client combobox control conversion csharp database databaseconnection datagrid datagridview dataset datetime dbconnection decryption degrees design draganddrop drawing encryption enum eventhandlers excel file firefox focus form format forms function gdi+ grantorrevokepermissionthroughc#.net hospitalmanagementsystem image input install java label libraries list loop mandelbrot marshalbyrefobject math mouseclick movingimage mysql netcfsvcutil.exe numeric operator path photoshop php picturebox pixelinversion platform polynomial post programming properties radians regex remoting richtextbox server sleep socket sql statistics string stringformatting study system.servicemodel table tcpclientchannel teamsuite text textbox thread time timer update usb usercontrol validation visualstudio webbrowser winforms wpf wpfc# xml





