Code:
private void btnSave_Click(object sender, System.EventArgs e)
{
if (txtBoxFName.Text.Length != 0)
{
string accessPath = Application.StartupPath.ToString() + "/data.mdb";
string strConn = "provider=Microsoft.JET.OLEDB.4.0; " + "data source = " + accessPath;
OleDbConnection myConn = new OleDbConnection(strConn) ;
myConn.Open();
string strInsert = "INSERT INTO contact (id_groups, first_name, middle_name, last_name, address, city, country, phone1, mobile, e_mail, url) VALUES('"+ selectedGroup +"','"+ txtBoxFName.Text +"', '"+ txtBoxMName.Text +"', '"+ txtBoxLName.Text +"', '"+ txtBoxAddress.Text +"', '"+ txtBoxCity.Text +"', '"+ txtBoxCountry.Text +"', '"+ txtBoxPhone.Text +"', '"+ txtBoxMobile.Text +"', '"+ txtBoxEmail.Text +"', '"+ txtBoxUrl.Text +"')";
OleDbCommand inst = new OleDbCommand(strInsert,myConn) ;
inst.ExecuteNonQuery() ;
myConn.Close() ;
}
else
{
MessageBox.Show(this,"First Name must be entered","info",MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
[Ovu poruku je menjao kristian! dana 07.01.2006. u 11:17 GMT+1]