Calling a Stored Procedure From ASP.NET 2.0

Protected Sub Btn1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Btn1.Click

Dim sConnStr As String = {MyConnectionString}
Dim cnBKTest As New SqlConnection(sConnStr)
Dim cmdTest As New SqlCommand("Insert_Test", cnBKTest)

cmdTest.CommandType = Data.CommandType.StoredProcedure
cmdTest.Parameters.Add(New SqlParameter("@TestParam", Data.SqlDbType.VarChar, 10))
cmdTest.Parameters("@TestParam").Value = "Testing"
cnBKTest.Open()
cmdTest.ExecuteNonQuery()
cnBKTest.Close()

End Sub


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: