How to pass parameter value to Stored Procedure ?

Just Drag and drop one grid view control on your web page.

In Aspx Page:-

[code]
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim command As New SqlCommand
Dim StrConnection As New SqlConnection("server=servername;database=databasename;uid=userid;pwd=password;") 'Give your connection string
Dim myDataReader As SqlDataReader
Dim Res As New StringBuilder
Dim da As SqlDataAdapter
command.Connection = StrConnection
command.Connection.Open()
command.CommandText = "ReturnMultipleValues" ' Give your sp name
Command.CommandType = CommandType.StoredProcedure
command.Parameters.AddWithValue("@ParameterName1", "YourValue")
command.Parameters.AddWithValue("@ParameterName2", "YourValue")
Dim dt As New DataTable
myDataReader = command.ExecuteReader()
dt.Load(myDataReader)
End Sub
End Class

[/code]

No comments:

Post a Comment

Plz Share your comments...