View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.charting
GAC.Me.Up.baby
 
Posts: n/a
Default how can i query an sheet with a where clause....from c# code using

hello ,

i'm triing to retreive buch of row but i want to apply a Where clause, so i
get row = a certain date..... but my Query retreive only 1 row always(the
first one)...but several should match... i even set the col format to string
and still get only 1 row and got no syntax error.. ex:
THE SQL PARM LOOKS LIKE :
"SELECT F12 AS [Strategy], F5 AS [Quantite], F7 AS [Devise], F2 AS
[Portefeuille], F4 AS [Ticker], F1 AS [Date], F3 AS [TradeType], F9 AS
[Status], F10 AS [Courtier], F8 AS [Commision], F11 AS [Commentaire], F6 AS
[Prix] FROM [2002$] WHERE F1 ='11/28/2005' "

Method call:

public DataTable Select(string sql)
{
OleDbDataAdapter da = new OleDbDataAdapter(sql, _connection);
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}

Anything wrong with the where clause..??? i even put the col format has
string and copy the exact string im looking for in the col ...but the query
still returning only 1 row (the first one).... and should be way more.