//存储过程代码CREATE PROCEDURE [AddNewInvoiceInfo] (@sUserID int,@sClaimMethod varchar(50),@sInvoiceNumvarchar(50),@sInvoiceDate datetime,@sBuyCity varchar(50))ASInsert Into SMB_InvoiceInfo (MemberID,ClaimMethod,InvoiceNum,InvoiceDate,InvoiceCity) Values(@sUserID,@sClaimMethod,@sInvoiceNum,@sInvoiceDate,@sBuyCity)return @@IDENTITYGO//调用存储过程代码Dim CN As New SqlConnection()Dim InvoiceID As StringTryCN.ConnectionString = DBConStrCN.Open()Dim CMD As SqlCommandCMD = New SqlCommand(AddNewInvoiceInfo, CN)CMD.CommandType = CommandType.StoredProcedureCMD.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.TextCMD.Parameters.Add(New SqlParameter(@sInvoiceNum, SqlDbType.VarChar, 50))CMD.Parameters(@sInvoiceNum).Value = InvoiceNum.TextCMD.Parameters.Add(New SqlParameter(@sInvoiceDate, SqlDbType.DateTime))CMD.Parameters(@sInvoiceDate).Value = InvoiceDate.SelectedDate.DateCMD.Parameters.Add(New SqlParameter(@sBuyCity, SqlDbType.VarChar, 50))CMD.Parameters(@sBuyCity).Value = BuyCity.TextCMD.Parameters.Add(New SqlParameter(@sInvoiceID, SqlDbType.Int))CMD.Parameters(@sInvoiceID).Direction = ParameterDirection.ReturnValueCMD.ExecuteNonQuery()InvoiceID = CMD.Parameters(@sInvoiceID).Value.ToString()CMD.Dispose()Catch ex As ExceptionResponse.Write(ex.ToString())FinallyCN.Close()End Try
导读:目前正在解读《VB.Net调用存储过程并得到返回值》的相关信息,《VB.Net调用存储过程并得到返回值》是由用户自行发布的知识型内容!下面请观看由(电工技术网 - www.9ddd.net)用户发布《VB.Net调用存储过程并得到返回值》的详细说明。
简介:本文给出VB.Net调用存储过程并得到返回值的代码。
提醒:《VB.Net调用存储过程并得到返回值》最后刷新时间 2024-03-14 01:02:21,本站为公益型个人网站,仅供个人学习和记录信息,不进行任何商业性质的盈利。如果内容、图片资源失效或内容涉及侵权,请反馈至,我们会及时处理。本站只保证内容的可读性,无法保证真实性,《VB.Net调用存储过程并得到返回值》该内容的真实性请自行鉴别。