vb.net - Parameter name is missing, While executing Function via code -
am trying execute following code
dim transaction pgsqltransaction dim command new pgsqlcommand dim paramlastno pgsqlparameter = command.parameters.add("funcupdategtab03", pgsqltype.int) command.connection = myconnstr myconnstr.open() command.transaction = transaction transaction = command.connection.begintransaction() try command.commandtext = _ "select funcupdategtab03(" & sord & "," & gintacyrid & "," & gintbranchid & ");" command.executescalar() updategtab03 = paramlastno.value transaction.commit() return updategtab03 catch ex exception transaction.rollback() msgbox(ex.message, msgboxstyle.information, "rstari9 - updategtab03") catch ex exception transaction.rollback() msgbox(ex.message, msgboxstyle.information, "rstari9 - updategtab03") myconnstr.close() end try
and function have created
create or replace function funcupdategtab03(ivrid integer, iacyrid integer, ibranchid integer) returns integer $body$ declare id_val int; begin update gtab03 set lastno=lastno+1 vrid=ivrid , acyrid=iacyrid , branchid=ibranchid returning lastno id_val; return id_val; end; $body$ language plpgsql volatile cost 100;
- the above function updating table error getting follows
error parameter name missing.
you have created input parameter , try use output parameter. parameter isn't used @ in query couldn't value, , result returned query ignored.
remove parameter, , result executescalar
method:
updategtab03 = command.executescalar()
you should consider using parameters 3 input values, instead of concatenating them query.
Comments
Post a Comment