Dim conString As String = "Persist Security Info=False;Data Source=localhost;Initial Catalog=DB;User ID=sa;Password =''"
strSelect="Select Count (*) as number from ws_User"
Dim Conn As SqlConnection = New SqlConnection(conString)
Dim cmd As SqlCommand = New SqlCommand(strSelect, Conn)
Dim Da As SqlDataAdapter = New SqlDataAdapter
Da.SelectCommand = cmd
Dim ds As DataSet = New DataSet
Dim ccount As interger
Try
Conn.Open()
Da.Fill(ds, "nTable")
if ds.Table(0).rows.count>0 then
ccount=ds.Table(0).rows(0).Item("Number")
endif
Catch ex As Exception
'MsgBox("数据打开失败", 64, "天晴提示")
End Try
MessageBox.Show(ccount);