参考一段vb的代码:
tmpCon = New SqlConnection(strCon)
Try
tmpCon.Open()
tmpParam = New SqlParameter("@New_C", SqlDbType.Int)
tmpParam.Direction = ParameterDirection.Output tmpCmd = New SqlCommand
With tmpCmd
.Connection = tmpCon
.CommandText = "GET_CONFIRMATION"
.CommandType = CommandType.StoredProcedure
.Parameters.Add(tmpParam) .ExecuteNonQuery() End With
result = CType(tmpParam.Value, Int64)
tmpCon.Close()
Catch ex As Exception
MsgBox(ex.Message)
tmpCon.Close()
result = -1
Finally
tmpCmd = Nothing
tmpParam = Nothing
tmpCon = Nothing
tmpCommonDB = Nothing End Try
tmpCon = New SqlConnection(strCon)
Try
tmpCon.Open()
tmpParam = New SqlParameter("@New_C", SqlDbType.Int)
tmpParam.Direction = ParameterDirection.Output tmpCmd = New SqlCommand
With tmpCmd
.Connection = tmpCon
.CommandText = "GET_CONFIRMATION"
.CommandType = CommandType.StoredProcedure
.Parameters.Add(tmpParam) .ExecuteNonQuery() End With
result = CType(tmpParam.Value, Int64)
tmpCon.Close()
Catch ex As Exception
MsgBox(ex.Message)
tmpCon.Close()
result = -1
Finally
tmpCmd = Nothing
tmpParam = Nothing
tmpCon = Nothing
tmpCommonDB = Nothing End Try
解决方案 »
- 请问上次浏览文件的路径如何得到。上次是用OpenFileDialog对象浏览目录的
- 这是我写的远程连接数据库的代码,但是总是连接不上服务器的数据库
- C#中鼠标事件
- [急]c# FileUpload 如何才能同时选择多个文件
- C#做的服务端程序,为什么,运行一段时间后,程序界面消失了?
- 动态textbox问题
- 菜鸟请教
- (高分求救)那位高手做过类似这样的项目!!!!!···!·!·@@@@@@@@
- 往一个panel中动态的插入自定义控件
- C#脚本的问题
- Socket异步通讯如何实现多线程?在进行文件传输时,是不是指令和文件数据通过不通端口传输?
- 有人能回答这个小问题吗?在线等,有了答案马上给分!
存储过程是有OUTPUT,还有返回的结果集
在.NET里面怎么接收呀?