<pre>
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = connection;
if (txtEnterToSaudi.Text == "" && txtStartWorkDate.Text != "" && txtStopWork.Text != "")
{
cmd.CommandText = "insert into Start_Stop_Work (InvoiceNo,ID,ShortName,StartWork,StopWork) values ('" + txtInvoiceNo.Text + "','" + txtID.Text + "','" + txtShortName.Text + "','" + txtStartWorkDate.Text + "','" + txtStopWork.Text + "')";
}
else if (txtEnterToSaudi.Text != "" && txtStartWorkDate.Text == "" && txtStopWork.Text != "")
{
cmd.CommandText = "insert into Start_Stop_Work (InvoiceNo,ID,ShortName,EnterDate,StopWork) values ('" + txtInvoiceNo.Text + "','" + txtID.Text + "','" + txtShortName.Text + "','" + txtEnterToSaudi.Text + "','" + txtStopWork.Text + "')";
}
else if (txtEnterToSaudi.Text != "" && txtStartWorkDate.Text != "" && txtStopWork.Text == "")
{
cmd.CommandText = "insert into Start_Stop_Work (InvoiceNo,ID,ShortName,EnterDate,StartWork) values ('" + txtInvoiceNo.Text + "','" + txtID.Text + "','" + txtShortName.Text + "','" + txtEnterToSaudi.Text + "','" + txtStartWorkDate.Text + "')";
}
else if (txtEnterToSaudi.Text == "" && txtStartWorkDate.Text == "" && txtStopWork.Text != "")
{
cmd.CommandText = "insert into Start_Stop_Work (InvoiceNo,ID,ShortName,StopWork) values ('" + txtInvoiceNo.Text + "','" + txtID.Text + "','" + txtShortName.Text + "','" + txtStopWork.Text + "')";
}
else if (txtEnterToSaudi.Text != "" && txtStartWorkDate.Text == "" && txtStopWork.Text == "")
{
cmd.CommandText = "insert into Start_Stop_Work (InvoiceNo,ID,ShortName,EnterDate) values ('" + txtInvoiceNo.Text + "','" + txtID.Text + "','" + txtShortName.Text + "','" + txtEnterToSaudi.Text + "')";
}
else if (txtEnterToSaudi.Text == "" && txtStartWorkDate.Text != "" && txtStopWork.Text == "")
{
cmd.CommandText = "insert into Start_Stop_Work (InvoiceNo,ID,ShortName,StartWork) values ('" + txtInvoiceNo.Text + "','" + txtID.Text + "','" + txtShortName.Text + "','" + txtStartWorkDate.Text + "')";
}
else if (txtEnterToSaudi.Text == "" && txtStartWorkDate.Text == "" && txtStopWork.Text == "")
{
MessageBox.Show("please fill all data before press add");
}
else
{
cmd.CommandText = "insert into Start_Stop_Work (InvoiceNo,ID,ShortName,EnterDate,StartWork,StopWork) values ('" + txtInvoiceNo.Text + "','" + txtID.Text + "','" + txtShortName.Text + "','" + txtEnterToSaudi.Text + "','" + txtStartWorkDate.Text + "','" + txtStopWork.Text + "')";
}
connection.Open();
cmd.ExecuteNonQuery();
connection.Close();
MessageBox.Show("Saved Done for " + txtID.Text);