I have this code that I try to fill a table in a databse.
I push the ok button, I receive no error but nothing is in my table.
can anyone tell me what could be wrong?
Thanks
private void button1_Click(object sender, EventArgs e)
{
string conection = @" Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = C:\Edy\Visual Studio\Last planner system\Last planner system\planning data.mdf";
using (SqlConnection con = new SqlConnection(conection))
con.Open();
SqlCommand cmd = new SqlCommand("INSERT INTO (Project name) values (Name, Starting date, End date, Description ");
cmd.Parameters.Add("Name", SqlDbType.NVarChar).Value = txtName.Text;
cmd.Parameters.Add("Starting date ", SqlDbType.Date).Value = txtStartDate.Text;
cmd.Parameters.Add("End date", SqlDbType.Date).Value = TxtEndDate.Text;
cmd.Parameters.Add("Description", SqlDbType.Text).Value = txtDescription.Text;
using (SqlConnection con1 = new SqlConnection(conection))
con1.Close();
MessageBox.Show("Done!!!");
Rijwan AnsariPosted Feb 9, 2021, 1:23 PM
Jignesh KumarPosted Feb 9, 2021, 7:20 AM
Rijwan AnsariPosted Feb 6, 2021, 4:30 PM
Sachin SinghPosted Feb 6, 2021, 4:25 PM
Rijwan AnsariPosted Feb 6, 2021, 4:13 PM
Jose HernandezPosted Feb 6, 2021, 4:35 AM
Eduard SzigetiPosted Jan 28, 2021, 7:58 PM
Sachin SinghPosted Jan 28, 2021, 4:13 PM