你好!有没有vb.net对SQL数据库进行增删改查的例子
1个回答
展开全部
一般都是vb.net传入参数 交给存储过程去做的 你是要在vb.net前台就执行的例子 还是想要调用存储过程的例子
前台的一般就是这样
Dim paras As New NameValueCollection
paras .Append("delete from T_AlarmConfig ")
paras .Append(" where AlarmConfigID=@AlarmConfigID")
调用存储过程的就是给写存储过程了,这是调用存储过程的例子,只能理解理解
''' <summary>
''' 删除数据
''' </summary>
''' <param name="procName">存储过程名</param>
''' <param name="paras">存储过程参数</param>
''' <remarks>
''' 2006-5-29 zhuzh Created
''' </remarks>
Public Sub DeleteData(ByVal procName As String, _
ByVal paras As NameValueCollection, _
Optional ByVal timeout As Integer = 30)
eventCount += 1
'存储过程参数名数组
Dim paraNames As String() = {}
'存储过程参数值数组
Dim paraValues As String() = {}
'传入的参数转化成数组
Me.ConvertNameValueCollection(paras, paraNames, paraValues, STATUS_UPDATE)
'判断系统类型调用相应模块的方法
If isWebSys Then
DeleteDelegateInstance = AddressOf webGw.ExecProc
Else
DeleteDelegateInstance = AddressOf AdoGw.ExecProc
End If
Dim ret As Integer = 0
Dim ds As New DataSet
'----guojun 2008-1-2 add-----
If timeout < 60000 Then
timeout = 60000
End If
'--------防止超时异常--------
DeleteDelegateInstance.BeginInvoke(procName, ret, ds, paraNames, paraValues, timeout, _
AddressOf DataDeletedCallBack, Nothing)
End Sub
前台的一般就是这样
Dim paras As New NameValueCollection
paras .Append("delete from T_AlarmConfig ")
paras .Append(" where AlarmConfigID=@AlarmConfigID")
调用存储过程的就是给写存储过程了,这是调用存储过程的例子,只能理解理解
''' <summary>
''' 删除数据
''' </summary>
''' <param name="procName">存储过程名</param>
''' <param name="paras">存储过程参数</param>
''' <remarks>
''' 2006-5-29 zhuzh Created
''' </remarks>
Public Sub DeleteData(ByVal procName As String, _
ByVal paras As NameValueCollection, _
Optional ByVal timeout As Integer = 30)
eventCount += 1
'存储过程参数名数组
Dim paraNames As String() = {}
'存储过程参数值数组
Dim paraValues As String() = {}
'传入的参数转化成数组
Me.ConvertNameValueCollection(paras, paraNames, paraValues, STATUS_UPDATE)
'判断系统类型调用相应模块的方法
If isWebSys Then
DeleteDelegateInstance = AddressOf webGw.ExecProc
Else
DeleteDelegateInstance = AddressOf AdoGw.ExecProc
End If
Dim ret As Integer = 0
Dim ds As New DataSet
'----guojun 2008-1-2 add-----
If timeout < 60000 Then
timeout = 60000
End If
'--------防止超时异常--------
DeleteDelegateInstance.BeginInvoke(procName, ret, ds, paraNames, paraValues, timeout, _
AddressOf DataDeletedCallBack, Nothing)
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询