Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack Then
GridView1.Visible = True
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cmd As New SqlCommand("spInsertData", New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ToString()))
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@name", txtName.Text)
cmd.Parameters.AddWithValue("@city", txtCity.Text)
cmd.Connection.Open()
cmd.ExecuteNonQuery()
cmd.Connection.Close()
Label1.Text = "<b>" & txtName.Text & "</b> has been added to the database using a Stored Procedure."
End Sub
End Class