private void cmdAdd_Click(object sender, EventArgs e)
{
String connStr= "Data Source=ACER-LAPTOP\a2006; Database=AED_MOBILE_0; Initial Catalog=db_stuRegisterPay; Integrated Security=SSPI";
SqlConnection myConnection = new SqlConnection(connStr);
myConnection.Open();
SqlCommand myCommand = new SqlCommand("INSERT INTO TestInfo(TestIC, TestName, TestPhone) " + "VALUES('" + txtIC.Text + "','" + txtName.Text + "','" +
txtPhone.Text + "')", myConnection);
try
{
myCommand.ExecuteNonQuery();
BCE.Application.AppMessage.ShowMessage("Pass!!!");
}
catch
{
BCE.Application.AppMessage.ShowMessage(myCommand.CommandText );
}
myConnection.Close();
}
if not working then explain your error.