sathish kumar

sathish kumar

  • NA
  • 117
  • 165.2k

sql2008 error

May 19 2012 12:59 AM
 i am inserting like below ::::::: my datatype of ExpiryDate is date in sql2008


DateTime ExDate = DateTime.Parse(txtExpiryDate.Text);

                strSQL = " INSERT INTO [OpeningBalance] ([Location],[ItemCode],[BatchNo],[ExpiryDate],[Qty],[UOM],[Rate],[Value])VALUES ('" + ddlLocation.SelectedItem.ToString() + "','" + txtItemCode.Text + "','" + txtBatchNo.Text + "','" + ExDate + "', '" + txtQty.Text + "','" + ddlUom.SelectedItem.ToString() + "','" + txtRate.Text + "','" + txtValue.Text + "')";


 but

while updating it shows invalid date error        

Below is mu updating query:

    strSQL = "Update [OpeningBalance] Set BatchNo='" + txtBatchNo.Text + "',Qty='" + txtQty.Text + "',UOM='" + ddlUom.SelectedItem.ToString() + "',Rate='" + txtRate.Text + "',Value='" + txtValue.Text + "',ExpiryDate='" + ExDate + "' Where ItemCode ='" + txtItemCode.Text + "'";
           
 any1 help me please....its urgent....Thanks in advance....

Answers (1)