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
Post a Comment