asp.net - SQL OUTPUT Parameter Not Assigning -
i have following sql statement written in sql server 2008 isn't returning value output parameter though there data in table. added static values , ran query alone , produced record not sure if has stored procedure or vb.net code.
alter procedure [dbo].[getgeninfo_delete01_01_22] @idx int, @fpath varchar(100) output begin select @fpath = filepath geninfo_e1_01_22 id = @idx delete geninfo_e1_01_22 id = @idx end
my vb code
using con new sqlconnection(connstr) using cmd new sqlcommand() cmd.commandtype = commandtype.storedprocedure cmd.commandtext = "getgeninfo_delete01_01_22" cmd.parameters.add("idx", id) cmd.parameters.add("@fpath", sqldbtype.varchar, 100) cmd.parameters("@fpath").direction = parameterdirection.output cmd.connection = con con.open() gridview1.datasource = cmd.executereader() gridview1.databind() con.close() end using end using
an output parameter not show in result set. can't read executereader()
.
you can read like:
dim result string = cmd.parameters("@fpath").value
Comments
Post a Comment