Group:  Microsoft Excel ยป microsoft.public.excel.querydao
Thread: How to query an excel sheet from an c# method.Specially Date field

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

How to query an excel sheet from an c# method.Specially Date field
GAC.Me.Up.baby 01.12.2005 14:35:05
hello ,

1 . 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.


2. IF i put the date col has a DATE format..my query return me the date in a
numbering format like 38667...wht kind of format i can apply to my query
string to get the date in aformat like : mm/dd/yyyy.

thanks for your help.

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net