Why my database is always can only receive the first data, provide data is written into the database behind
Private void timer1_Tick (object sender, EventArgs e)
{
If (this. Receive_TextBox Text!="")
{Insert (); }
}
SqlDataAdapter sda.
SqlDataAdapter sda1.
Public void Insert ()//
to write data into the database{
Try
{//interception string
String STR=this. Receive_TextBox. Text. The Trim (), ToString ();
String s=STR. The Substring (STR. Length - 8, 8).
SqlConnection conn=new SqlConnection (@ "Server=pxba \ SQLEXPRESS PC - 20161210; The database=HM; uid=sa; The PWD=");
conn.Open();
String str_sql="insert into Sing (AttendanceDate Attendancein, Attendanceout, ICcard)"
+ "values (@ AttendanceDate, @ Attendancein @ Attendanceout, @ ICcard)";
SqlCommand cmd1=new SqlCommand (str_sql, conn);
//SqlParameter parn2=new SqlParameter (" @ EmployeeNo ", "");
//cmd1. The Parameters. The Add (parn2);
//SqlParameter parn1=new SqlParameter (" @ EmployeeName ", "");
//cmd1. The Parameters. The Add (parn1);
SqlParameter parn=new SqlParameter (" @ ICcard ", s);
Cmd1. The Parameters. The Add (parn);
SqlParameter parn3=new SqlParameter (" @ AttendanceDate, "dateTimeAttendDate. Value. ToString (" yyyy - MM - dd) + comboAttendIn. Text. The Trim (), ToString ());
Cmd1. The Parameters. The Add (parn3);
SqlParameter parn4=new SqlParameter (" @ Attendancein, "comboAttendIn. Text. The Trim (), ToString ());
Cmd1. The Parameters. The Add (parn4);
SqlParameter parn5=new SqlParameter (" @ Attendanceout, "comboAttendOut. Text. The Trim (), ToString ());
Cmd1. The Parameters. The Add (parn5);
//SqlParameter parn6=new SqlParameter (" @ queqin ", "");
//cmd1. The Parameters. The Add (parn6);
Cmd1. ExecuteNonQuery ();
conn.Close();
}
Catch Exception (ex) {MessageBox. Show (ex. Message); }
}