c# - stored Procedure usage in ASP.NET -


i using storedprocedure in sqlserver 2005.

stored procedure:

create proc usegetasp @partycode nvarchar(50) select *  partyregister  partycode=@partycode go 

i trying execute asp.net visual studio 2010.

by researching code came know should use

 cmd.commandtype = commandtype.storedprocedure 

but unfortunatly commandtype.storedprocedure not there , not working.

hence used:

cmd.commandtype = sqldatasourcecommandtype.storedprocedure; 

but not working. shows me red line below [as comes when type invalid]. tooltip shows me error as: commandtype 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 mistake?

what command should use implementing stored procedure?

please me.

try this:

system.data.commandtype.storedprocedure 

source: http://msdn.microsoft.com/en-us/library/system.data.commandtype.aspx


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -