I am using StoredProcedure in sqlserver 2005.
Stored Procedure:
create proc useGetASP @PartyCode nvarchar(50) as select * from partyRegister where PartyCode=@PartyCode Go
I tried to execute it with visual studio 2010 asp.net.
After learning the code, I found out that I should use
cmd.CommandType = CommandType.StoredProcedure
But unfortunately, CommandType.StoredProcedure is not there, it does not work.
Therefore, I used:
cmd.CommandType = SqlDataSourceCommandType.StoredProcedure;
But that doesn't work either. He shows me the red line below [How it comes when we enter something invalid]. As a hint, it shows me an error like: CommandType does not exists in current context
My full code is:
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 my mistake?
Which command should I use to implement the stored procedure?
Please help me.
source share