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

Whats the difference between registerclientscriptblock, registerclientscriptinclude and registerclientscriptresource?

818


How can you pass multiple complex types in Web API?

768


Is post back property in asp net?

745


What is side-by-side execution? Can two applications, one using a private assembly and other using a shared assembly, be stated as side-by-side executables?

780


How will you maintain versioning in asp.net 2.0?

760


What is the difference between client-side and server-side validations in ASP.NET?

887


Which method is used to force all the validation controls to run?

781


How will you do Redo and Undo in a TextControl?

871


How should I destroy my objects in asp.net?

789


what is AutoEventWireUp and what is the use of This property explain in details?

1354


How many types of Cookies are available in ASP.NET?

816


What is use of Master Page in ASP.NET web pages?

813


What is http only cookie?

736


What are Master Pages in ASP.NET? or What is a Master Page?

830


Explain MVC model binders?

806