Hello Every One I am new To C# and SQL can any one tell me where am I wrong. It is not inserting . And not giving any errors.
SqlConnection myConnection = new SqlConnection("server=SHASHAK\\SQLEXPRESS;" +
"Trusted_Connection=yes;" +
"database=Abhishek; " +
"connection timeout=30");
private void btnShow_Click(object sender, EventArgs e)
{
try
{
//myConnection.Open();
//// SqlCommand cmd = new SqlCommand("select player_id, player_name , score from player", myConnection);
SqlCommand cmd = new SqlCommand("INSERT INTO Abhishek (" + " player_id, player_name " + ") VALUES (" + " @textBox1.Text, @textBox2.Text", myConnection);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
MessageBox.Show("Ok");
//DataTable dt = new DataTable();
//adapter.Fill(dt);
//screen.DataSource = dt;
}
catch (SqlException ex)
{
MessageBox.Show("You failed!" + ex.Message);
}
}