Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server-2008
hi all
How to call a stored procedure in asp.net at run time (with select query that return three column values.
Posted 19-Feb-13 22:55pm
Comments
Karthik Harve at 20-Feb-13 3:59am
   
What have you tried ? where you stuck ? Improve your question.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Your StoreProcedure : 
 
create procedure SP_Example(@var1 varchar(20))
As
Begin
 
Select Column1 ,Column2,Column3 From tempTable where Column1= @var1
 
End
-----------
Code for asp.net
 
SqlCommand Cmd;
       SqlDataReader dr;
       SqlConnection Con = new SqlConnection("Your connection String");
       Cmd = new SqlCommand("SP_Example", Con);
       Cmd.CommandType = CommandType.StoredProcedure;
       Cmd.Parameters.Add("@Column1 ",SqlDbType.VarChar).Value="D025";
       Con.Open();
 
       while(dr.read())
       {
       Response.Write(dr[0].ToString()+" "+dr[1].ToString()+" "+ dr[2].ToString()+"\n");
       }
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

  Permalink  

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

  Print Answers RSS
0 OriginalGriff 190
1 Jochen Arndt 155
2 PIEBALDconsult 150
3 Afzaal Ahmad Zeeshan 120
4 DamithSL 115
0 OriginalGriff 5,695
1 DamithSL 4,591
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 20 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100