请各位高手帮忙解释一下最后两个函数谢谢
Imports System.data '引入命名空间
Imports System.data.SqlClient '同上
Imports System.ComponentModel '同上
Public Class database
Implements IDisposable
Private sqlconn As SqlConnection '定义一个sql数据库连接
Public Shared sconn As String = "persist security info=false; " _
+ "integrated security=sspi;database=men; " _
+ "server=localhost;connect timeout=30 "’定义sconn字符串
Public Sub Dispose() Implements System.IDisposable.Dispose '释放资源函数
Dispose(True)
GC.SuppressFinalize(True)
End Sub
Protected Sub dispose(ByVal disposing As Boolean)
If disposing <> True Then '如果已经释放了,就返回
Return
End If
If sqlconn Is Nothing = False Then '如果连接不为空就把连接释放
sqlconn.Dispose()
sqlconn = Nothing
End If
End Sub
Public Sub open() '打开连接
If sqlconn Is Nothing = True Then '如果没有连接把连接打开
sqlconn = New SqlConnection(Me.sconn)
sqlconn.Open()
End If
End Sub
Public Sub close() '关闭连接
If sqlconn Is Nothing = False Then '如果有连接把连接关闭
sqlconn.Close()
End If
End Sub
Public Function runselectsql(ByVal ssqlstring _
As System.String) As DataView
Me.open()
Dim sqlds As DataSet = New DataSet
Dim sqlda As SqlDataAdapter = New SqlDataAdapter(ssqlstring,Me.sqlconn)
sqlda.Fill(sqlds)
Return sqlds.Tables(0).DefaultView
End Function
Public Function rundelorinssql(ByVal ssqlstring _
As System.String)
Me.open()
Dim sqlcomm As SqlCommand = New SqlCommand(ssqlstring, Me.sqlconn)
sqlcomm.ExecuteNonQuery()
End Function
[解决办法]
runselectsql运行select 语句,返回dataview
rundelorinssql运行delete 语句
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码)
最新版本:20070130
http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html
[解决办法]
1.填充dataset对象。并返回一个DataView对象
2.执行你传进来的sql语句
没什么可说的了