2013-07-09 7 views
-1

프로그래밍에 새로운 기능이있어서 문제가 있습니다. 나는 그 텍스트 상자를 어떻게 불러야합니까? 나는 VB6에서 내 프로그램을 만들고 있는데, 여기 내 코드가있다.텍스트 상자의 연결 문자열

Private Sub lvButtons_H2_Click() 
On Error GoTo errtrap 
If Label47.Caption = "True" Then 
MsgBox "INITIAL SETTING FOR SHIP ACCOUNT IS BEING PERFORMED", vbOKOnly, "ABORT" 
Exit Sub 
End If 
Dim conas As New ADODB.Connection, rs01 As New ADODB.Recordset, rsx1 As New ADODB.Recordset, RS9 As New ADODB.Recordset 
conas.Connectio`enter code here`nString = Text1155.Text 
conas.Open 
Set RS9 = New ADODB.Recordset 
    RS9.ActiveConnection = conas 
    RS9.CursorType = 3 
    RS9.LockType = 3 
    RS9.Open ("SELECT * FROM [SHIPACCOUNT].[dbo].[SPARE PART LIST BOND 29 MONTHLY] WHERE NAMECODE = " & Text2.Text & "") 
    Set DataReport2.DataSource = RS9 

    DataReport2.Sections("Section2").Controls.item("LABEL12").Caption = Text1.Text 
    DataReport2.Sections("Section2").Controls.item("LABEL11").Caption = Text3.Text 

    DataReport2.Sections("Section1").Controls.item("TEXT1").DataField = RS9![PARTSNAME].Name 
    DataReport2.Sections("Section1").Controls.item("TEXT2").DataField = RS9![Price].Name 
    DataReport2.Sections("Section1").Controls.item("TEXT3").DataField = RS9![unit].Name 
    DataReport2.Sections("Section1").Controls.item("TEXT4").DataField = RS9![QTYAPPLY].Name 
    DataReport2.Sections("Section1").Controls.item("TEXT5").DataField = RS9!QTYAPPROVE.Name 
    DataReport2.Sections("Section1").Controls.item("TEXT6").DataField = RS9![AMOUNTAPPROVE].Name 
    DataReport2.Sections("Section1").Controls.item("TEXT7").DataField = RS9![Date].Name 


DataReport2.Show 1 

Exit Sub 
errtrap: 
MsgBox Err.Description, vbCritical, "The system encountered an error" 
End Sub 

답변

1

당신은 같은 Connection.Open method 에 매개 변수로 연결 문자열을 전달할 수 있습니다 (텍스트 상자의 이름을 가정하는 것은 Text1155입니다) :

Dim conas As New ADODB.Connection 

conas.Open Text1155.Text 

는 (당신은 하위를 호출 괄호가 필요하지 않습니다 vb6에서) 코드가 다른 것처럼 보입니다 ...

+0

... 아직 행운이 있습니까? – mortb

관련 문제