'连接数据库的方法:
Public Shared Function getConnectionString() As String
Dim conStr As String = System.Configuration.ConfigurationManager.ConnectionStrings("TEST.ConnectionString").ConnectionString
Return conStr
End Function
'查询某个表
Public Shared Function getFileCount() As Boolean
Using connection1 As New System.Data.SqlClient.SqlConnection(getConnectionString())
Dim sqlCommand1 As New System.Data.SqlClient.SqlCommand
Dim reader1 As System.Data.SqlClient.SqlDataReader
connection1.Open()
sqlCommand1 = New System.Data.SqlClient.SqlCommand("select * From TableName , connection1)
sqlCommand1.CommandType = CommandType.Text
reader1 = sqlCommand1.ExecuteReader
Return reader1.HasRows
If sqlCommand1 IsNot Nothing Then sqlCommand