how to use procedure in asp.net

nedash
 
on Feb 12, 2012 10:39 PM
7071 Views

hi

i have 2 procedure in my DB

1-

CREATE PROCEDURE SP_GetTableCode    @Key varchar(50) AS BEGIN     SET NOCOUNT ON;
    select T_Code    from tradeTable    where Keyword= @Key    END

 

2-

CREATE PROCEDURE SP_GetDetails  @T_Code int AS BEGIN      SET NOCOUNT ON;
    if @T_Code = 1    begin     select * from HotelTable    end    else
    if @T_Code = 2    begin         select * from tranigtable     endEND


i want use this procedure in my web site and show tables in my page how i can do it?
can you help me it is very important to me
tanx alot

 

Download FREE API for Word, Excel and PDF in ASP.Net: Download
nedash
 
on Feb 12, 2012 11:50 PM
on Feb 12, 2012 11:51 PM

ok

i referd  tanx

i have 2 procedure in my DB and i want use both of them in 1 page how i can do it how i can write 2 procedure name in my page?

 

String strConnString =  ConfigurationManager.ConnectionStrings["conString"].ConnectionString;

SqlConnection con =  new SqlConnection(strConnString);

SqlCommand cmd = new SqlCommand();

cmd.CommandType = CommandType.StoredProcedure;

cmd.CommandText = "GetAllEmployeeDetails";

cmd.Connection = con;

 

 

 

 

here is 

cmd.CommandText = "GetAllEmployeeDetails";
i want put 2 proscedure in my command text can i do it ?
plese see my procedure .
tanx
Mudassar
 
on Feb 13, 2012 12:31 AM

Here

http://www.aspforums.net/Threads/167754/search/Replies/3#Replies

I have given you query. You put that query in one stored proc and there is no need to create or call multiple stored procs

nedash
 
on Feb 13, 2012 01:54 AM

tanx alot