0
我有一個問題,當I M運行我的代碼然後錯誤發生的是「」 System.Data.OleDb.OleDbException:數據類型不匹配條件表達式中。 「」。 和數據類型是Number。數據類型不匹配,在c#
PLZ建議我關於該。
「代碼
protected void btn_Save_Click(object sender, EventArgs e)
{
string str = ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/Users/Geeta/Desktop/eTimeTrackLite1.mdb;Persist Security Info=False;");
OleDbConnection conn = new OleDbConnection(str);
conn.Open();
string query = "insert into Employees (EmployeeName,EmployeeCode,Designation,Grade,Team,Location,EmployementType,HolidayGroup) values ('" + txt_empname.Text + "','" + txt_code.Text + "', '"+ Convert.ToString(dp_designation.SelectedItem)+"', '"+Convert.ToString(dp_grade.SelectedItem)+"', '"+Convert.ToString(dp_team.SelectedItem)+"', '"+Convert.ToString(dp_location.SelectedItem)+"', '"+Convert.ToString(dp_emptype.SelectedItem)+"', '"+Convert.ToString(dp_holigroup.SelectedItem)+"')";
OleDbCommand cmd = new OleDbCommand(query, conn);
cmd.ExecuteNonQuery();
conn.Close();
BindGridData();
}
‘謝謝’