uspatel
Вы можете получить представление о вставке и Upadtion
Для вставки
public static bool Insert_File(string FileNo, string CUSTOMER_NAME, string ProjectName, string STATUS,string date,string ins)
{
try
{
string stinsert = "Insert into File (FileNo,CUSTOMER_NAME,ProjectName,STATUS,IDate,InsertedBy) values (@FileNo,@CUSTOMER_NAME,@ProjectName,@STATUS,@date,@ins)";
//string stinsert1 = "Insert into FileCord (FileNo,CUSTOMER_NAME,ProjectName,STATUS,IDate) values (@FileNo,@CUSTOMER_NAME,@ProjectName,@STATUS,@date)";
OleDbCommand cmdinsert = new OleDbCommand(stinsert, GetConnection());
cmdinsert.Parameters.AddWithValue("FileNo", FileNo);
cmdinsert.Parameters.AddWithValue("CUSTOMER_NAME", CUSTOMER_NAME);
cmdinsert.Parameters.AddWithValue("ProjectName", ProjectName);
cmdinsert.Parameters.AddWithValue("STATUS", STATUS);
cmdinsert.Parameters.AddWithValue("date",date);
cmdinsert.Parameters.AddWithValue("ins",ins);
cmdinsert.ExecuteNonQuery();
cmdinsert.Connection.Close();
return true;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
return false;
}
}
для обновлений
public static bool Update_Received(string FileNo, string ReqControlNo, string ReceiveDate, string Remarks, string received)
{
try
{
string s1 = "Update Issue set ReceivedDate='" + ReceiveDate + "',ReceivedRemarks= '" + Remarks + "',ReceiveTime='" + received + "' where FileNo='" + FileNo + "' AND ReqControlNo='" + ReqControlNo + "'";
OleDbCommand cmd1 = new OleDbCommand(s1, GetConnection());
cmd1.ExecuteNonQuery();
cmd1.Connection.Close();
string stts = "Available";
string st3 = "Update File set STATUS='" + stts + "' where FileNo='" + FileNo + "' ";
OleDbCommand cmd11 = new OleDbCommand(st3, GetConnection());
cmd11.ExecuteNonQuery();
cmd11.Connection.Close();
return true;
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.ToString());
return false;
}