Jump to content
Sign in to follow this  
ayu110

Nak Mtk Tolong Jenguk Jap

Recommended Posts

akum

ni command c++ borland yg saya nak buat tak jadi. saya nak buat dia keluarkan msg kalo cdate>cdate2 dia kuar msg "lewat". kalo awak dia kuar "ok" masalhnyer saya buat smua kuar lewat. camner yer

void __fastcall TfrmPekerja::Button1Click(TObject *Sender)

{

//ShowMessage(cdate);

//ShowMessage(cdate2);

double cdate = DateTimePicker6->Time;

double cdate2 = DateTimePicker3->Time;

if (cdate > cdate2)

ShowMessage("Lewat");

else

ShowMessage("OK!");

TVSQLQuery *q = DB->CreateQuery();

q->Text ="insert into KeyInTime(INSERTDATE,ICNumber, \

Mode,DateIn,TimeIn,DateOut,TimeOut)\

values(:INSERTDATE,:ICNumber, \

:Mode,:DateIn,:TimeIn,:DateOut,:TimeOut)";

q->ParamByName("INSERTDATE",DateTimePicker1->DateTime);

q->ParamByName("ICNumber",Edit5->Text);

//q->ParamByName("StaffName",Edit1->Text);

//q->ParamByName("Department",Edit2->Text);

//q->ParamByName("Department",ComboBox5->Text);

//q->ParamByName("Position",ComboBox6->Text);

q->ParamByName("Mode",MODECODE->Strings[ComboBox1->ItemIndex]);

//q->ParamByName("Code",STAFFTYPECODE->Strings[ComboBox2->ItemIndex]);

q->ParamByName("DateIn",DateTimePicker2->Date);

q->ParamByName("TimeIn",DateTimePicker3->Time);

q->ParamByName("DateOut",DateTimePicker4->Date);

q->ParamByName("TimeOut",DateTimePicker5->Time);

q->ExecSQL();

delete q;

ShowMessage("Data has been added");

Close();

}

Share this post


Link to post
Share on other sites

double cdate = DateTimePicker6->Time;

        double cdate2 = DateTimePicker3->Time;

Aku tak sure pasal C++Builder ni, tapi betul ke Time tu jenis double? Takde struct TTime or something?

debug la utk tengok variable tu.. guna breakpoint dan watch ..

Share this post


Link to post
Share on other sites

make sure correct Date for each DateTimePicker since u just nak compare Time. another thing tak perlu laa create variables cdate. compare terus, e.g

if (DateTimePicker6->Time > DateTimePicker3->Time) ...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...