Arsip: Access Date Datatype on Excel by ADOQuery use Delphi

 
user image
more 11 years ago

iammcrayeps

Hi.. Guys, gw ada sepenggal sourcecode.. gw ambil data dari excel, di excel data tersebut bertipe tanggal.. gw mau compare dan ambil data dari excel yang dimana tanggalnya adalah tanggal hari ini... berikut sourcecode nya: DataModule2.ADOQuery1.Close; DataModule2.ADOQuery1.SQL.Text:='SELECT COUNT(REFNO) AS DATACOUNT FROM [FSALESH$] WHERE TRDATE='+DateToStr(tanggal)+' AND INVOICENO LIKE '+QuotedStr('STR%'); DataModule2.ADOQuery1.Open; Tapi g bisa ambil data yang bertipe Date... Jadi recordcount nya 0 trus... Anybody help? Thanks
user image
more 11 years ago

elva_ivana

kutipnya ketimggalan Bro ...

DataModule2.ADOQuery1.Close;
DataModule2.ADOQuery1.SQL.Text:='SELECT COUNT(REFNO) AS DATACOUNT FROM [FSALESH$] WHERE TRDATE='''+DateToStr(tanggal)+''' AND INVOICENO LIKE '+QuotedStr('STR%');
DataModule2.ADOQuery1.Open; 
user image
more 11 years ago

iammcrayeps


  DataModule2.ADOQuery1.Close;
  DataModule2.ADOQuery1.SQL.Text:='SELECT COUNT(REFNO) AS DATACOUNT FROM [FSALESH$] WHERE TRDATE='''+Datetostr(tanggal)+''' AND INVOICENO LIKE '+QuotedStr('STR%');
  DataModule2.ADOQuery1.Open;
Tetep error bro, 'Data Type Mismatch in criteria expression' ini ak sambung ke excel loh bro... error bro...
user image
more 11 years ago

iammcrayeps


  DataModule2.ADOQuery1.Close;
  DataModule2.ADOQuery1.SQL.Text:='SELECT COUNT(REFNO) AS DATACOUNT FROM [FSALESH$] WHERE TRDATE='''+Datetostr(tanggal)+''' AND INVOICENO LIKE '+QuotedStr('STR%');
  DataModule2.ADOQuery1.Open;
Tetep error bro, 'Data Type Mismatch in criteria expression' ini ak sambung ke excel loh bro... error bro...
user image
more 11 years ago

iammcrayeps

Ini kode gw :
  path := 'c:\DOSemenTemp\FSALESH.xls';
  connectString:='Provider=Microsoft.Jet.OLEDB.4.0;' +
           'Data Source=' + path + ';' +
           'Extended Properties=Excel 8.0;';
  ADOConnection1.Close;
  ADOConnection1.ConnectionString:=connectString;
  ADOConnection1.Open;
  tanggal:=Date-6;
  FormatDateTime('m/d/yy',tanggal);
  edit1.Text:=DateToStr(tanggal);
  ADOQuery1.Close;
  ADOQuery1.SQL.Text:='SELECT TRDATE FROM [FSALESH$] WHERE TRDATE='+DateToStr(tanggal);
  ADOQuery1.Open;
  ADOQuery1.First;
  memo1.Clear;memo1.Lines.Add(IntToStr(ADOQuery1.RecordCount));
  for I := 1 to ADOQuery1.RecordCount do
  begin
    memo1.Lines.Add(ADOQuery1['TRDATE']);
    ADOQuery1.Next;
  end;
data di excel 9/1/2009 tanggal di delphi 9/1/2009 sama persis tp g ketemu recordcount nya 0!! hux
more ...
  • Pages:
  • 1
Share to

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com