Hi Expert!
I want to used stored procedure in my asp. net application. I'm using SQL Server 2005. My line of code as following.
create proc useGetASP @PartyCode nvarchar(50)
as
select *
from partyRegister
where PartyCode=@PartyCode
Go
I was trying to execute it with asp.net visual studio 2010.
I'm try as following.
cmd.CommandType = CommandType.StoredProcedure
But unfortunatly CommandType.StoredProcedure is not there , its not working.
Hence i used:
cmd.CommandType = SqlDataSourceCommandType.StoredProcedure;
But this is also not working. It shows me red line below it [As comes when we type something invalid]. As a tooltip it shows me error as: CommandType does not exists in current context
My Full Code:
con.Open();
cmd = new SqlCommand("useGetASP",con);
//cmd.CommandType =CommandType./*Not Working*/
cmd.CommandType = SqlDataSourceCommandType.StoredProcedure;/*Also Not Working*/
cmd.Parameters.AddWithValue("@PartyCode","0L036");
what's I'm missing in my code?
What command should I use for implementing stored procedure?
Please Help Me.
Any help will be appreciated.
AVADHESH PATEL
13-May-2013