Hi, I want to call my simple stored procedure in my app's local database. This is my procedure:

ALTER PROCEDURE dbo.booklist
	
AS
	select * from book
	RETURN

----------
Actually I should run my query that is simple and return list of books (SELECT * FROM book). I should do this job via stored procedure(school stuff).
How can I have booklist in a data-table. Should I have Parameter for execute this procedure?

Recommended Answers

All 3 Replies

You don't need a parameter as there is nothing that changes in the query. You run a stored procedure exactly like you execute a SQL statement. What classes you use depend on what database you are using.

After creating the procedure just Execute it to return everything from "book".

EXEC booklist

exec <name of the procedure>

if you have parameterized stored procedure then
exec <name of the procedure> <'param1'> <param2> ....etc

Note single quote for char value and no quotes for int parameter

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.