Hi all I have been stuck at this for two days. I am using Visual Studio 2013
and made a windows form project. Then using the following code I am trying to insert values but the "show Table data" option produces a table with null values. What have I done wrong?
SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.
ConnectionStrings["WindowsFormsApplicationtodatabase.Properties.Settings.DatabasewebConnectionString"].ConnectionString);
conn.Open();
using (conn)
{
SqlCommand cmd = new SqlCommand("INSERT INTO webtable (Id, url_name) VALUES (@id, @url)");
cmd.CommandType = CommandType.Text;
cmd.Connection = conn;
cmd.Parameters.AddWithValue("@url", "nagia");
cmd.Parameters.AddWithValue("@id", "9");
cmd.ExecuteNonQuery();
}