-
Data Type Mismatch
An addendum to my previous message. Here is the function inside my dll that
extracts the records:
Private Sub Retrieve()
Dim comStrategic As ADODB.Command
Dim conStrategic As ADODB.Connection
Dim rsList As ADODB.Recordset
Dim pTransitNo As ADODB.Parameter
Dim pStart As ADODB.Parameter
Dim pEnd As ADODB.Parameter
Dim dtSearchStart As Date
Dim dtSearchEnd As Date
mstrTracer = "Inside Retrieve, just starting"
If mnYear = 0 Or mnMonth = 0 Or mnBillTransit = 0 Then
Err.Raise errInsufficientCriteria, "LM6Secur::Retrieve", "At least one
of the following search criteria is zero: " & _
" Year = " & Str(mnYear) & ", Month = " & Str(mnMonth) & ", bill transit
= " & Str(mnBillTransit)
End If
mstrTracer = "Inside Retrieve, setting search start and search end"
dtSearchStart = DateSerial(mnYear, mnMonth, 1)
dtSearchEnd = DateAdd("m", 1, dtSearchStart)
mstrTracer = "Inside Retrieve, setting conStrategic"
Set conStrategic = New ADODB.Connection
With conStrategic
.ConnectionString = GetSetting("lm6secure.dll", _
"Database", _
"Connection", _
mkstrDefaultAuthentication)
.Open
End With
mstrTracer = "Inside Retrieve, setting comStrategic"
Set comStrategic = New ADODB.Command
With comStrategic
Set .ActiveConnection = conStrategic
.CommandText = "sp_selectdata"
.CommandType = adCmdStoredProc
End With
mstrTracer = "Inside Retrieve, setting pTransitNo"
Set pTransitNo = New ADODB.Parameter
With pTransitNo
.Name = "transit number"
.Direction = adParamInput
.Type = adInteger
.Value = mnBillTransit
End With
mstrTracer = "Inside Retrieve, setting pStart"
Set pStart = New ADODB.Parameter
With pStart
.Name = "search date start"
.Direction = adParamInput
.Type = adDBTimeStamp
.Value = dtSearchStart
End With
mstrTracer = "Inside Retrieve, setting pEnd"
Set pEnd = New ADODB.Parameter
With pEnd
.Name = "search end date"
.Direction = adParamInput
.Type = adDBTimeStamp
.Value = dtSearchEnd
End With
mstrTracer = "Inside Retrieve, appending parameters"
With comStrategic.Parameters
.Append pTransitNo
.Append pStart
.Append pEnd
End With
'extract recordset
mstrTracer = "Inside Retrieve, executing"
Set rsList = comStrategic.Execute
Dim lCounter As Long
lCounter = 0
With rsList
mcrRunningTotal = 0#
mstrNineYards = ""
While Not .EOF
mstrTracer = "Inside Retrieve at record " & Str(lCounter) & ", incrementing
mcrRunningTotal"
mcrRunningTotal = mcrRunningTotal + Format(.Fields("Cost").Value,
"$###,###.00")
mstrTracer = "Inside Retrieve at record " & Str(lCounter) & ", retrieving
ReferenceNumber"
mstrNineYards = mstrNineYards & "<tr><td>" & .Fields("ReferenceNumber").Value
& "</td>"
mstrTracer = "Inside Retrieve at record " & Str(lCounter) & ", retrieving
ProductNumber"
mstrNineYards = mstrNineYards & "<td>" & .Fields("ProductNumber").Value
& "</td>"
mstrTracer = "Inside Retrieve at record " & Str(lCounter) & ", retrieving
ItemDescription"
mstrNineYards = mstrNineYards & "<td>" & .Fields("ItemDescription").Value
& "</td>"
mstrTracer = "Inside Retrieve at record " & Str(lCounter) & ", retrieving
Quantity"
mstrNineYards = mstrNineYards & "<td>" & Str(.Fields("Quantity").Value)
& "</td>"
mstrTracer = "Inside Retrieve at record " & Str(lCounter) & ", retrieving
Cost"
mstrNineYards = mstrNineYards & "<td>" & Format(.Fields("Cost").Value,
"$###,###.00") & "</td>"
mstrTracer = "Inside Retrieve at record " & Str(lCounter) & ", retrieving
ShipTransit"
mstrNineYards = mstrNineYards & "<td>" & Str(.Fields("ShipTransit").Value)
& "</td>"
mstrTracer = "Inside Retrieve at record " & Str(lCounter) & ", retrieving
GL"
mstrNineYards = mstrNineYards & "<td>" & .Fields("GL").Value & "</td></tr>"
& vbCrLf
.MoveNext
lCounter = lCounter + 1
Wend
End With
mstrTracer = "Inside Retrieve, cleaning up"
Set pTransitNo = Nothing
Set pStart = Nothing
Set pEnd = Nothing
comStrategic.ActiveConnection.Close
Set comStrategic = Nothing
Set rsList = Nothing
End Sub
and here is my stored procedure:
/*****Procedure to test Error ****/
CREATE PROCEDURE SP_SelectData @TransitNumber int,
@StartString varchar(12),
@EndString varchar(12),
@Listener varchar(30) = NULL
AS
declare @EndDate datetime
declare @StartDate datetime
select @StartDate = convert(datetime,@StartString,100)
select @EndDate = convert(datetime,@EndString,100)
SELECT ReferenceNumber, ProductNumber, ItemDescription, Quantity, Cost, ShipTransit,
GL
FROM Chargeouts
WHERE Chargeouts.BillTransit = @TransitNumber AND
Chargeouts.ImportDate >= @StartDate AND Chargeouts.ImportDate <= @EndDate
GO
I would appreciate it if someone could at least give me an idea why this
isn't working.
Thanks,
Maria
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|