Dim mycnn As New SqlConnection
Dim myds As New DataSet
Dim sqladp As New SqlDataAdapter
mycnn.ConnectionString = "Data Source=localhost;User ID=sa;Password=sa;Initial Catalog=table;integrated security=false"
mycnn.Open()
sqladp = New SqlDataAdapter("select Value from table, mycnn)
myds = New DataSet()
sqladp.Fill(myds)
我想问一下,上面语句中要知道value的个数有多少,代码怎么写啊。
相当于下面的红色语句。
Dim cnnAs New ADODB.Connection
Dim rsAs New ADODB.Recordset
Dim strSQLAs String
cnn.Open "Provider=SQLOLEDB;Data Source='" & servername & "';User ID=sa;Password=sa;Initial Catalog=table;Persist security Info=True"
Set rs= New ADODB.Recordset
strSQL= "select value FROM ltable
rs.Open strSQL, cnn, adOpenStatic, adLockReadOnly
row = rs_new.RecordCount