How to execute a stored procedure.and how to call it form a
asp page

Answer Posted / ramesh

This u cn run in sql server

"execute SP_Name Parameter1,Parameter2,..."

Dim SQLDBDataReader As SqlClient.SqlDataReader
Dim SQLDataTable As New DataTable

SQLCmd.CommandText = "GetAuthors"
SQLCmd.CommandType = CommandType.StoredProcedure
SQLCmd.Connection = SQLCon
SQLCmd.Parameters.Add(New SqlClient.SqlParameter
("AuthorName", SqlDbType.VarChar, 100,
ParameterDirection.Input, False, 30, 0, "",
DataRowVersion.Current, "Y%")) SQLDBDataReader =
SQLCmd.ExecuteReader() SQLDataTable.Columns.Add
("AuthorName", GetType(Int32), "") SQLDataTable.Columns.Add
("AuthorLocation", GetType(String), "")

Dim FieldValues(1) As Object 'A Temporary Variable to
retrieve all columns in a row and fill them in Object array

While (SQLDBDataReader.Read)
SQLDBDataReader.GetValues(FieldValues)
SQLDataTable.Rows.Add(FieldValues)

End While

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the caspol.exe tool used for?

538


How u refer webservices?

1489


When was asp.net released?

564


What are sql notifications and sql invalidations?

525


They mostly asked difference between versions of technologies

934






What is synchronous and Asynchronous post back ?

637


What are the security types in asp.net?

572


How many types of state management are there in asp net?

518


What is razor? : asp.net mvc

553


What are the differences between code behind and code inline?

510


How to use multiple scriptmanager controls in a web page?

599


What are the file extensions for razor views?

669


Describe the disadvantage of cookies.

594


What is custom attribute? How to create?

537


What is the default authentication mode for asp.net?

558