I'm a newbie using ASP.NET. I'm using VB and web matrix (for what it's worth).
I've got a page that has a "Submit" button which runs an INSERT query into an ACCESS db. Clicking submit inserts a new record into a dB and that seems to be working.
My problem: Clicking submit inserts the record into the db, but it doesn't clear the fields, validate, or give any indication on the page that the record was updated.
I'm looking for straight-forward code that will validate the info, insert the record, and show a confirmation message to the user.
Here's my OnClick event.
Sub SubmitSolution(sender As Object, e As EventArgs)
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; " & _
Dim dbConnection As New OleDbConnection(connectionString)
Dim commandString As String = "INSERT INTO tblSolutions(CategoryID, SolutionTitle, Solution) " & _
"Values(@CategoryID, @SolutionTitle, @Solution)"
Dim dbCommand As New OleDbCommand(commandString, dbConnection)
Dim CategoryIDParam As New OleDbParameter("@CategoryID", OleDbType.VarChar, 10)
CategoryIDParam.Value = DropDownList1.SelectedItem.Value
Dim SolutionTitleParam As New OleDbParameter("@SolutionTitle", OleDbType.VarChar, 100)
SolutionTitleParam.Value = TextBox4.Text
Dim SolutionParam As New OleDbParameter("@Solution", OleDbType.VarChar, 100)
SolutionParam.Value = TextBox1.Text
Thanks for your help.
I'm looking for specific code examples, tx.