hi,
can anybody help me :(?
when i want to save the record in access database and i cannot save it :(
this is error
http://www.geocities.com/qtruni/eee.JPG
and this the code for save button
++++++++++++++++++++++++++++++++++++++++++++++++++ +
private void Savebutton_Click(object sender, System.EventArgs e)
{
if (sidTextBox.Text != "" && fnameTextBox.Text != "" && lnameTextBox.Text != "" && nationalityTextBox.Text != "" && phoneTextBox.Text != "")
{
OleDbConnection myCon = new OleDbConnection(strCon);
// OleDbConnection myCon = new OleDbConnection( strCon ) ;
//the string to get values from the textboxes and form an "INSERT INTO"
// statement.
string sqlStr = "INSERT INTO student(sid, fname, lname, nationality, phone, major,college)"
+ " VALUES (" + this.sidTextBox.Text + ","
+ this.fnameTextBox.Text + ","
+ this.lnameTextBox.Text + ","
+ this.nationalityTextBox.Text + ","
+ this.phoneTextBox.Text + ","
+ this.majortextBox1.Text + ","
+ this.collegeComboBox.SelectedItem + ");";
// create Objects of ADOConnection and ADOCommand
OleDbConnection myConn = new OleDbConnection(strCon);
OleDbCommand myCmd = new OleDbCommand(sqlStr, myConn);
try
{
myConn.Open();
myCmd.ExecuteNonQuery();
}
catch (Exception ed)
{
MessageBox.Show("Error in inserting! " + ed.ToString(), "Error");
}
finally
{
myConn.Close();
}
}
}
++++++++++++++++++++++++++++
where is the error ?????