扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:佚名 来源:Microsoft 2007年11月8日
关键字: Windows
Private Sub btnGetTopic_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles btnGetTopic.Click Try Dim ID As Integer = Int32.Parse(txQueryID.Text) GetItem(ID) ' 进行数据库调用 txID.Text = txQueryID.Text txTitle.Text = mTitle txDescription.Text = mDescription lbStatus.Text = "success!" Catch ex As Exception lbStatus.Text = ex.Message End Try End Sub |
Private Sub GetItem(ByVal ID As Integer) Try pr = New SqlParameter("RETURN_VALUE", SqlDbType.Int) pr.Direction = ParameterDirection.ReturnValue Dim pTitle As SqlParameter = New SqlParameter With pTitle .Direction = ParameterDirection.Output .DbType = DbType.String .ParameterName = "@Title" .Size = 30 End With Dim pDescription As SqlParameter = New SqlParameter With pDescription .Direction = ParameterDirection.Output .DbType = DbType.String .ParameterName = "@Description" .Size = 500 End With cd = New SqlCommand With cd .CommandText = "TopicsGetItem" .CommandType = CommandType.StoredProcedure .Parameters.Add(New SqlParameter("@AdminCode", "adm")) .Parameters.Add(New SqlParameter("@ID", ID)) .Parameters.Add(pTitle) .Parameters.Add(pDescription) .Parameters.Add(pr) .Connection = cn .Connection.Open() .ExecuteNonQuery() .Connection.Close() End With ' 检查返回代码 If Not pr.Value Is Nothing Then Select Case Int32.Parse(pr.Value) Case 100 : Throw New ApplicationException("Access violation") Case 101 : Throw New ApplicationException("Invalid ID") End Select End If ' 设置返回值 mTitle = pTitle.Value.ToString() mDescription = pDescription.Value.ToString() Catch ex As Exception Throw New Exception(ex.Message, ex) End Try End Sub |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者