//存储过程代码
create procedure [addnewinvoiceinfo] (@suserid int,@sclaimmethod varchar(50),@sinvoicenum varchar(50),@sinvoicedate datetime,@sbuycity varchar(50))as
insert into smb_invoiceinfo (memberid,claimmethod,invoicenum,invoicedate,invoicecity) values (@suserid,@sclaimmethod,@sinvoicenum,@sinvoicedate,@sbuycity)
return @@identity
go
//调用存储过程代码
dim cn as new sqlconnection()
dim invoiceid as string
try
cn.connectionstring = dbconstr
cn.open()
dim cmd as sqlcommand
cmd = new sqlcommand("addnewinvoiceinfo", cn)
cmd.commandtype = commandtype.storedprocedure
cmd.parameters.add(new sqlparameter("@suserid", sqldbtype.int))
cmd.parameters("@suserid").value = cint(userid.text)
cmd.parameters.add(new sqlparameter("@sclaimmethod", sqldbtype.varchar, 50))
cmd.parameters("@sclaimmethod").value = transname.text
cmd.parameters.add(new sqlparameter("@sinvoicenum", sqldbtype.varchar, 50))
cmd.parameters("@sinvoicenum").value = invoicenum.text
cmd.parameters.add(new sqlparameter("@sinvoicedate", sqldbtype.datetime))
cmd.parameters("@sinvoicedate").value = invoicedate.selecteddate.date
cmd.parameters.add(new sqlparameter("@sbuycity", sqldbtype.varchar, 50))
cmd.parameters("@sbuycity").value = buycity.text
cmd.parameters.add(new sqlparameter("@sinvoiceid", sqldbtype.int))
cmd.parameters("@sinvoiceid").direction = parameterdirection.returnvalue
cmd.executenonquery()
invoiceid = cmd.parameters("@sinvoiceid").value.tostring()
cmd.dispose()
catch ex as exception
response.write(ex.tostring())
finally
cn.close()
end try