Beruflich Dokumente
Kultur Dokumente
Private Sub Command1_Click() 'Initialize objects On Error GoTo Command3_ErrorProc: Dim adoConn As New ADODB.Connection Dim adoCmd As New ADODB.Command Dim objErr As ADODB.Error Dim adoParm As ADODB.Parameter Dim adoRs As ADODB.Recordset Dim RecordsAffected As Long Dim SqlSent As String Dim i As Integer List1.Clear
'Set cursor location to client, so that record count does not return -1 'See Microsoft Knowledge Base article Q194973 for discussion adoConn.CursorLocation = adUseClient Me.MousePointer = 11
'Select statement with WHERE criteria on first column 'Modify this statement if you are not using the provided sample table SqlSent = "SELECT * FROM ROHITDB2.TAB WHERE T1 = 'Rohit'"
'Command brproperties set<>adoCmd.Name = "TestParm" Set adoCmd.ActiveConnection = adoConn adoCmd.CommandText = SqlSent adoCmd.CommandType = adCmdText adoCmd.CommandTimeout = 15
'Parameter properties set Set adoParm = New ADODB.Parameter adoParm.Name = "MYPARM" adoParm.Type = adVarChar adoParm.Size = 10 adoCmd.Parameters.Append adoParm adoParm.Value = "TEST1"
'Return first column of each record in result set to List box For i = 1 To adoRs.RecordCount Text1.Text = adoRs(0) List1.AddItem adoRs(0) adoRs.MoveNext Next
'Clear connection Set adoCmd = Nothing Set adoConn = Nothing Me.MousePointer = 0 Exit Sub
'Error handling Command3_ErrorProc: Me.MousePointer = 0 If Not adoCmd Is Nothing Then Set adoCmd = Nothing End If If Not adoConn Is Nothing Then Set adoConn = Nothing End If
Exit Sub
End Sub
'Initialize objects
Dim adoConn As New ADODB.Connection Dim adoCmd As New ADODB.Command Dim objErr As ADODB.Error Dim adoParm As ADODB.Parameter Dim adoRs As ADODB.Recordset Dim RecordsAffected As Long Dim SqlSent As String Dim i As Integer Dim k As Integer
List1.Clear
'Set cursor location to client, so that record count does not return -1 'See Microsoft Knowledge Base article Q194973 for discussion
'Select statement with WHERE criteria on first column 'Modify this statement if you are not using the provided sample table SqlSent = "INSERT INTO ROHITDB2.TAB (T1 )VALUES('chaman')"
'Command brproperties set<>adoCmd.Name = "TestParm" Set adoCmd.ActiveConnection = adoConn adoCmd.CommandText = SqlSent adoCmd.CommandType = adCmdText adoCmd.CommandTimeout = 15
'Parameter properties set Set adoParm = New ADODB.Parameter adoParm.Name = "MYPARM" adoParm.Type = adVarChar adoParm.Size = 10 adoCmd.Parameters.Append adoParm adoParm.Value = "TEST1"