VB5.0中的2维数组在VB.NET中如何应用
Private Sub SetParam()
Dim Lv_Lng_Sts As Short
Dim Lv_Str_Sql As String ''SQL
Dim Lv_Str_Record() As String
If Trim(Lv_Str_Kishu) <> "" Then
Lv_Str_Sql = "SELECT 機種分類2 FROM 機種表 "
Lv_Str_Sql = Lv_Str_Sql & "WHERE 機械区分 = '" & Lv_Str_Kikai & "' "
Lv_Str_Sql = Lv_Str_Sql & "AND 機種 = '" & Lv_Str_Kishu & "'"
Lv_Lng_Sts = MSZ715_DoSql2(Lv_Str_Sql, Lv_Str_Record)
'Lv_Str_Record就是出错的地方,因为它原来是2维数组用。详细看MSZ715_DoSql2方法。
If Lv_Lng_Sts = 1 Then
Txt_Bunrui21.Text = Lv_Str_Record(1, 1)
Txt_Bunrui22.Text = CBGetNameZ(Txt_Bunrui21, Cbo_Bunrui2)
Lv_Str_Bunrui2_Old = Txt_Bunrui21.Text
End If
End If
End Sub
Public Function MSZ708_DoSql(ByVal Lv_Str_Cmd As String, ByRef Lv_Str_RecordSet() As String, Optional ByVal Lv_Int_DbDesc As Short = 1, Optional ByVal Lv_Int_MsgMode As Short = mszMsgBoxOn) As Integer
Dim Lv_Int_Ret As Short
Dim Lv_Str_ErrStr As String
Dim Lv_Obj_OraDynaset As Object
On Error Resume Next
MSZ708_DoSql = 0
ReDim Lv_Str_RecordSet(0, 0)
If (Gv_Lng_OraRecCnt > 0) Then ReDim Lv_Str_RecordSet(Gv_Lng_OraRecCnt, Gv_Int_OraFldCnt)
Erase Lv_Obj_Fld
ReDim Lv_Obj_Fld(Gv_Int_OraFldCnt - 1)
For Lv_Int_Idx = 0 To Gv_Int_OraFldCnt - 1
Lv_Obj_Fld(Lv_Int_Idx) = Lv_Obj_OraDynaset.Fields(Lv_Int_Idx)
Next Lv_Int_Idx
'Lv_Obj_OraDynaset.MoveFirst
For Lv_Int_Idx = 0 To (Gv_Lng_OraRecCnt - 1)
For Lv_Int_Idx1 = 0 To (Gv_Int_OraFldCnt - 1)
Lv_Str_RecordSet(Lv_Int_Idx + 1, Lv_Int_Idx1 + 1) = MSZ712_NullToSpace(Lv_Obj_Fld(Lv_Int_Idx1).Value)
' Lv_Str_RecordSet(Lv_Int_Idx + 1, Lv_Int_Idx1 + 1) = Lv_Obj_Fld(Lv_Int_Idx1).Value
Next Lv_Int_Idx1
Lv_Obj_OraDynaset.MoveNext()
Next Lv_Int_Idx
End If --------------------编程问答-------------------- 这个没有区别的
补充:.NET技术 , VB.NET