Home » Infrastructure » Windows » Multiple-step OLE DB operation generated errors. (VBA, Windows 7)
Multiple-step OLE DB operation generated errors. [message #651425] |
Tue, 17 May 2016 11:01 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
oteixeira
Messages: 33 Registered: May 2007
|
Member |
|
|
Hello to all.
The following code is producing the error:
"-2147217887:Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available.No work was done."
I've been googling for this but found no solution.
Can someone please give me an idea how to solve this problem?
Many thanks in advance.
Octavio
Private Sub CommandButton1_Click()
On Error GoTo erro
Dim conn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim ccmd As New ADODB.Command
Dim tourist1 As New ADODB.Parameter 'par 1
Dim data_ini As New ADODB.Parameter 'par 2
Dim data_fin As New ADODB.Parameter 'par 3
Dim iloc As New ADODB.Parameter 'par4
Dim tourist2 As New ADODB.Parameter ' par 5
Dim tourist3 As New ADODB.Parameter 'par 6
If Me.TextBox1.Text = "" Or Me.TextBox2.Text = "" Then
Exit Sub
End If
If Me.ComboBox1.Text = "" Then
MsgBox ("Tem de usar uma invoicing location")
Exit Sub
End If
Dim dbConnectStr As String
dbConnectStr = "Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.172.99.39)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=PRODL)));User ID=APPS;Password=APPS;"
conn.ConnectionString = dbConnectStr
conn.Open
'MsgBox (conn.State)
ccmd.ActiveConnection = conn
ccmd.CommandText = "SELECT ilo.name, c.name,decode('?', 'Y', t.NAME, 'ALL'),f.FLIGHT_NUMBER , to_char(f.flight_date_aux, 'DD-Mon-YYYY'), r.reference," _
& " sum(( Case When nvl(t.age,50) > 14 Then '1' Else '0' End ) * nvl(t.quantity,1))" _
& " ,sum(( Case When nvl(t.age,50) between 2 and 14 Then '1' Else '0' End" _
& ") * nvl(t.quantity,1)) ,sum(( Case When nvl(t.age,50) < 2 Then '1'" _
& " Else '0' End ) * nvl(t.quantity,1))" _
& " ,sum(nvl(t.quantity,1))" _
& " from inc_tourists t, inc_reservations r, inc_flights f, inc_customers_v c, inc_invoicing_locations ilo" _
& " where t.reservation_id = r.reservation_id And r.arrival_flight_id = f.flight_id" _
& " and r.customer_id = c.customer_id and r.invoicing_location_id = ilo.invoicing_location_id" _
& " and f.flight_date_aux between to_date(?, 'DD-MM-YYYY') and to_date(?, 'DD-MM-YYYY')" _
& " and ILO.NAME = 'Cabo Verde - Sal' group by ilo.name, c.name, f.flight_date_aux" _
& " , f.FLIGHT_NUMBER, r.reference, decode('?', 'Y', t.NAME, 'ALL'), to_char(f.flight_date_aux, 'DD-Mon-YYYY')" _
& " order by ilo.name, c.name, f.flight_date_aux, f.FLIGHT_NUMBER, r.reference, decode('?', 'Y', t.NAME, 'ALL')"
Set tourist1 = ccmd.CreateParameter("one", adVariant, adParamInput, 1, TextBox3.Text)
Set data_ini = ccmd.CreateParameter("two", adVariant, adParamInput, 1, TextBox1.Text)
Set data_fin = ccmd.CreateParameter("three", adVariant, adParamInput, 1, TextBox2.Text)
Set iloc = ccmd.CreateParameter("four", adVariant, adParamInput, 1, ComboBox1.Text)
Set tourist2 = ccmd.CreateParameter("five", adVariant, adParamInput, 1, TextBox3.Text)
Set tourist3 = ccmd.CreateParameter("six", adVariant, adParamInput, 1, TextBox3.Text)
ccmd.Parameters.Append tourist1
ccmd.Parameters.Append data_ini
ccmd.Parameters.Append data_fin
ccmd.Parameters.Append iloc
ccmd.Parameters.Append tourist2
ccmd.Parameters.Append tourist3
rst.CursorLocation = adUseClient
Set rst = ccmd.Execute [b]'error occurs here[/b]
If Err.Number <> 0 Then
erro: aux = MsgBox(CStr(Err.Number) & ":" & Err.Description, vbOKOnly, "ERRO - " & Err.Source) '
End If
conn.Close
End Sub
|
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sat Feb 08 01:02:30 CST 2025
|