用vb查询sql server 2000数据库将其中中符合查询条件的数据分别给变量
2个回答
展开全部
Dim VerString1(100) As String
Dim VerString(100) As String
Set adoPrimaryRS1 = New Recordset
adoPrimaryRS1.Open "select 客户简称 from KH_JBZL where 客户类型='销售商' " & OptionStr2 & "", DB, adOpenStatic, adLockOptimistic
If adoPrimaryRS1.RecordCount > 0 Then
adoPrimaryRS1.MoveFirst
For R = 0 To adoPrimaryRS1.RecordCount - 1
VerString1(R)=Trim(IIf(IsNull(adoPrimaryRS1!客户简称), "", adoPrimaryRS1!客户简称))
adoPrimaryRS1.MoveNext
Next R
End If
Dim VerString(100) As String
Set adoPrimaryRS1 = New Recordset
adoPrimaryRS1.Open "select 客户简称 from KH_JBZL where 客户类型='销售商' " & OptionStr2 & "", DB, adOpenStatic, adLockOptimistic
If adoPrimaryRS1.RecordCount > 0 Then
adoPrimaryRS1.MoveFirst
For R = 0 To adoPrimaryRS1.RecordCount - 1
VerString1(R)=Trim(IIf(IsNull(adoPrimaryRS1!客户简称), "", adoPrimaryRS1!客户简称))
adoPrimaryRS1.MoveNext
Next R
End If
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
动态数组:
Dim cnn As ADODB.Connection
Dim rs As New ADODB.Recordset
cnn.Open .......
rs.Open ........
Dim a(), i As Integer, j As Integer
ReDim a(rs.RecordCount - 1, rs.Fields.Count - 1)
For i = 0 To rs.RecordCount - 1
For j = 0 To rs.Fields.Count - 1
a(i, j) = rs(j)
Next
rs.MoveNext
Next
Dim cnn As ADODB.Connection
Dim rs As New ADODB.Recordset
cnn.Open .......
rs.Open ........
Dim a(), i As Integer, j As Integer
ReDim a(rs.RecordCount - 1, rs.Fields.Count - 1)
For i = 0 To rs.RecordCount - 1
For j = 0 To rs.Fields.Count - 1
a(i, j) = rs(j)
Next
rs.MoveNext
Next
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询