Must declare the scalar variable "@DateCreated".
Ive got that error when i hit submit button. I just want to add new record in database. Sir what is the problem?
Dim strSQL As String
Dim connection As SqlConnection = New SqlConnection("Data Source=ML0003135586;Initial Catalog=TestSQL;Integrated Security=True")
strSQL = "INSERT INTO [TblDUMMY](UserID, CostCenter, Curriculum, College, Category, CourseCode, CourseTitle, Duration, Discipline, Date_Created) VALUES (@UserID, @CostCenter, @Curriculum, @College, @Category, @CourseCode, @CourseTitle, @Duration, @Discipline, @DateCreated)"
connection.Open()
Dim command As New SqlCommand(strSQL, connection)
command.Parameters.Add("@CostCenter", SqlDbType.NVarChar).Value = lbl15029.Text
command.Parameters.Add("@Discipline", SqlDbType.NVarChar).Value = txt15029.Text
command.Parameters.Add("@College", SqlDbType.NVarChar).Value = ddCollege.Text
command.Parameters.Add("@Curriculum", SqlDbType.NVarChar).Value = ddCurriculum.Text
command.Parameters.Add("@Category", SqlDbType.NVarChar).Value = lblGEE.Text
command.Parameters.Add("@CourseCode", SqlDbType.NVarChar).Value = txtCCode.Text
command.Parameters.Add("@CourseTitle", SqlDbType.NVarChar).Value = txtCT.Text
command.Parameters.Add("@Duration", SqlDbType.NVarChar).Value = txtDuration.Text
command.Parameters.Add("@UserID", SqlDbType.NVarChar).Value = lblposition2.Text
command.Parameters.AddWithValue(",@DateCreated", SqlDbType.NVarChar).Value = Label1.Text
command.ExecuteNonQuery()
connection.Close()