I have been troubleshooting this for a week. I try to insert a value into a SQL Server database. It doesn't show any error but when I check the database, there's no data inserted. I might doing something that is wrong here but I can't find it. Thanks for helping.
Dim connect As New SqlConnection(ConfigurationManager.ConnectionStrings("SqlServer").ToString())
Using coa As New SqlCommand()
With coa
.Connection = connect
.CommandType = CommandType.Text
End With
Try
connect.Open()
Dim insertcmd As String
insertcmd = "insert into tblUserSection (@newValue, @SectionName, @newSectionID) values ," _
& "@newValue, @SectionName, @newSectionID);"
coa.Parameters.Add(New SqlParameter("@newValue", SqlDbType.BigInt))
coa.Parameters("@newValue").Value = newValue
coa.Parameters.Add(New SqlParameter("@SectionName", SqlDbType.NVarChar))
coa.Parameters("@SectionName").Value = SectionName.ToString
coa.Parameters.Add(New SqlParameter("@newSectionID", SqlDbType.BigInt))
coa.Parameters("@newSectionID").Value = newSectionID
coa.ExecuteNonQuery()
connect.Close()
MsgBox("success insert")
Catch ex As Exception
MsgBox("Fail to Save to database")
End Try
End Using