Click here to Skip to main content
15,886,840 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
I have windowsform in C# made in Visual Studio 2010, datasource is ACCESS 2007 accdb database. I have report with two datetime pickers which I joined F_date and T_ date but SQL doesnt work, specifically @F_date And @T_date.
it seems that @ doesnt work with accdb source file
because when I made new table without accdb as datasource then it works
I need help with the sql
down here is the sql that I am talking about, I bold the problem

SQL
SELECT RB, Bankomat, Datum_otvaranja, Vreme_prijave, ProView_vreme, Naziv_dogadjaja, Preduzeta_mera, Napomena FROM dnevni_izvestaj
WHERE Datum_otvaranja BETWEEN @F_date And @T_date



[Edited]Code is blocked in "pre" tags[/Edited]
Posted
Updated 6-Feb-11 2:40am
v2

1 solution

Are you querying over Odbc or OleDb? If so, then you should use a question-mark as a parameter-indication.

See the section Working with Parameter Placeholders
[^] :)
 
Share this answer
 
Comments
shonezi 6-Feb-11 9:07am    
It's OleDb connection, so how does the code should look like?
Henry Minute 6-Feb-11 9:20am    
For OleDb you are supposed to use positional parameters
WHERE Datum_otvaranja BETWEEN ? And ?

Because they are positional you must be very careful to add your parameters in the correct order.
This page has an example
http://weblogs.asp.net/cibrax/archive/2006/09/28/Parameterized-Queries-_2800_Oracle_2C00_-SQLServer_2C00_-OleDb_2900_.aspx (The last example.
Eddy Vluggen 6-Feb-11 9:36am    
As described on that page. Is there anything unclear in the documentation?
shonezi 6-Feb-11 9:38am    
I will look on it later, and let you know. thanks a lot
shonezi 6-Feb-11 16:50pm    
I have trouble with this parameter queries cause code from above is in dataset from which report was made

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900