Dim conn As New ADODB.Connection
Dim ret As New ADODB.Recordset
Dim str_sql As String
conn.ConnectionString = "Provider=SQLOLEDB.1;" & _
"Password=hrk;" & _
"Persist Security Info=True;" & _
"User ID=hrk;" & _
"Initial Catalog=HRK;" & _
"Data Source=."
conn.Open
str_sql = "SELECT xbm, lvbm, [2004-3-25] FROM t_sell1"
ret.Open str_sql, conn, adOpenKeyset, adLockOptimistic
If ret.RecordCount = -1 Then
MsgBox ret.RecordCount
Exit Sub
End If
ret.MoveFirst执行之后,ADO的记录集总是返回-1,这是为什么,是SQL Server的问题吗?
我用的是SQL Server 2000 sp3 + vb6.0 sp6
Dim ret As New ADODB.Recordset
Dim str_sql As String
conn.ConnectionString = "Provider=SQLOLEDB.1;" & _
"Password=hrk;" & _
"Persist Security Info=True;" & _
"User ID=hrk;" & _
"Initial Catalog=HRK;" & _
"Data Source=."
conn.Open
str_sql = "SELECT xbm, lvbm, [2004-3-25] FROM t_sell1"
ret.Open str_sql, conn, adOpenKeyset, adLockOptimistic
If ret.RecordCount = -1 Then
MsgBox ret.RecordCount
Exit Sub
End If
ret.MoveFirst执行之后,ADO的记录集总是返回-1,这是为什么,是SQL Server的问题吗?
我用的是SQL Server 2000 sp3 + vb6.0 sp6
ret.CursorLocation = adUseClient
就OK了,我太大意了,看看朋友们对这段程序还有什么其它的意见
http://community.csdn.net/Expert/topic/3453/3453514.xml?temp=2.578372E-02