Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Can I display data from a database using stored procedure ?
can any one help me ?
Posted
Comments
CHill60 31-Jul-14 20:20pm    
You can retrieve data using an SP. Display will need to be in a GUI of some description. Where are you stuck? What are you trying to do??
M-osab 31-Jul-14 20:26pm    
this is the code :
SqlConnection con= new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=GestionStage;Integrated Security=True");
con.Open();
string query = "StoredProcedure3";
SqlCommand com = new SqlCommand(query,con);
com.CommandType=CommandType.StoredProcedure;
com.ExecuteReader();
PIEBALDconsult 31-Jul-14 23:53pm    
Then you need to Read from the reader.
M-osab 31-Jul-14 20:27pm    
But I can not continue,I don't know what to do now
M-osab 1-Aug-14 10:24am    
Can you whrite the code to Read from the reader ?

1 solution

You can have a query (SELECT statement) (or more than one) in a stored procedure, but you still need something else to do the displaying.
 
Share this answer
 
Comments
M-osab 31-Jul-14 20:28pm    
Yes I created the stored procedure :
ALTER PROCEDURE StoredProcedure3
(
@Id int,
@Titre_offre nvarchar(200),
@Nom_encadrant nvarchar(50),
@Pôle_activité nvarchar(10),
@Description nvarchar(400)
)
AS
begin

select Id,titre_offre,Nom_encadrant,Pôle_activité,Description from offre

end

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900