Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing WHERE clause with csv files ADO.NET / C#
    primarykey
    data
    text
    <p>i have a little problem. I'm using a csv file as database and i'm asking it with ADO.NET's OLEDB funcions. I want to select only rows where column "DATA" is included between two datas, like this:</p> <pre><code>String conn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\; ;Extended Properties='text;HDR=Yes;Format=Delimited(;)';"; OleDbConnection cn = new OleDbConnection(conn); OleDbCommand cmd = new OleDbCommand("SELECT * FROM [mydb]", cn); OleDbDataAdapter daAd = new OleDbDataAdapter(); daAd.SelectCommand= cmd; cn.Open(); DataTable dt = new DataTable(); daAd.Fill(dt); DateTime mydata= Convert.ToDateTime("01/01/1990"); DateTime mydata2= Convert.ToDateTime("01/01/2000"); </code></pre> <p>Nothing wrong until now, but when i change</p> <pre><code> "SELECT * FROM [mydb]" </code></pre> <p>With </p> <pre><code> "SELECT * FROM [mydb] WHERE DATA&gt;= '"+ mydata.Date +"' AND DATA&lt;='"+ mydata2.Date +"' </code></pre> <p>I have an error saying "Syntax error (missing operator) in query 'WHERE DATA=> mydata AND DATA&lt;= mydata2'. I really don't know how to solve it. More info: .CSV file is formatted like this:</p> <pre><code>DATA;INFO1;INFO2;INFO3 01/01/1990;1;2;3` </code></pre> <p>And into schema.ini is this :</p> <pre><code>[mydb.csv] Format=Delimited(;) ColNameHeader=True DateTimeFormat=dd-MM-yyyy Col1=DATA DateTime Col2=info1 Long Width 3 Col3=info2 Integer Col4=info3 Integer </code></pre> <p><strong>EDIT :</strong> I'm running a x86 Seven, i read that for solve JET driver's incompatibility is sufficient the schema.ini file, hope i'm right.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload