|
-
Jan 2nd, 2007, 12:09 PM
#1
Thread Starter
Member
Verify record insertion using ExecuteNonQuery
Hi,
I'm using parameters on a SQL stored procedure to insert a record with data entered on a website form (and on the form I'm using VB.net). As of right now, the form works perfectly; the record is inserted. However, after the user hits the submit button, everything executes and then the page will basically refresh with emtpy values in all the fields. So I want to give the user some type of SUCCESS message, assuring the user the information was successfully entered into the database. So my question is: How can I verify that the record insertion was successful? I want to do this with the ExecuteNonQuery statement, because that's what I'm using. Code is below:
If Page.IsValid then
Dim MyConn as SQLConnection= New SQLConnection("Blah")
Dim MySQL As SQLCommand
MySQL= New SqlCommand("proc_newWebEntry", MyConn)
MySQL.CommandType = CommandType.StoredProcedure
MySQL.Parameters.Add(New SQLParameter("@UID", UID.text))
MySQL.Parameters.Add(New SQLParameter("@FirstName", txtFirstName.text))
MySQL.Parameters.Add(New SQLParameter("@LastName", txtLastName.text))
MyConn.Open()
MySQL.ExecuteNonQuery
MyConn.Close()
'Clear fields after record insertion
UID.text = ""
txtFirstName.text = ""
txtLastName.text = ""
End If
Thanks in advance!
-Wes
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|