private void InsertVideoDetails(string VideoId, string VideoTitle, string Description, int ViewCount, string LikeCount, string CommentCount, DateTime PublishedAt)
{
string sql = "INSERT INTO Videos (VideoId, VideoTitle, Description,LikeCount, ViewCount,CommentCount,Published_At) VALUES (@VideoId, @VideoTitle, @Description, @ViewCount,@LikeCount,@CommentCount,@PublishedAt)";
string constring = ConfigurationManager.ConnectionStrings["Cnn"].ConnectionString;
using (SqlConnection con = new SqlConnection(constring))
{
using (SqlCommand cmd = new SqlCommand(sql))
{
cmd.Parameters.AddWithValue("@VideoId", VideoId);
cmd.Parameters.AddWithValue("@VideoTitle", VideoTitle);
cmd.Parameters.AddWithValue("@Description", Description);
cmd.Parameters.AddWithValue("@ViewCount", ViewCount);
cmd.Parameters.AddWithValue("@LikeCount", LikeCount);
cmd.Parameters.AddWithValue("@CommentCount", CommentCount);
cmd.Parameters.AddWithValue("@PublishedAt", PublishedAt);
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}
}
Error -
|
Name |
Value |
Type |
|
Message |
"The parameterized query '(@VideoId nvarchar(11),@VideoTitle nvarchar(100),@Description nv' expects the parameter '@CommentCount', which was not supplied." |
string |