2: | Given the following code: SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; string s = "insert into movies(movie_title, movie_year, bestpicture)values(&p1,&p2,&p3); " cmd.CommandText= s; which of the following code segments completes the SQL query string to insert the movie row? string p1="Star Wars"; int p2 = 1977; string p3= "N"; cmd.Parameters.AddWithValue ("@p1","Star Wars"); cmd.Parameters.AddWithValue ("@p2", "1977"); cmd.Parameters.AddWithValue ("@p3", "N"); cmd.Parameters.Add("@p1", SqlDbType.NVarChar, 100); cmd.Parameters.Add("@p2", SqlDbType.NVarChar, 4); cmd.Parameters.Add("@p3", SqlDbType.NVarChar, 1); p1.Value = "Star Wars"; p2.Value = "1977"; p3.Value = "N";
|