1 Replies - 1372 Views - Last Post: 13 December 2013 - 11:22 AM Rate Topic: -----

#1 lacrue79  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 43
  • Joined: 12-August 09

Late Binding Error Converting VB6 to VB.NET

Posted 13 December 2013 - 11:07 AM

Hello, I'm getting late binding errors when attempting to convert a VB6 application over to VB.NET

The late binding errors are setting on .ActiveConnection, .ComandText, .CommandType, .Parameters, and .execute.

I don't really understand the error and how to resolve it. Any help is appreciated. Thanks!

 
Dim Command As Object 'New ADODB.Command
        Command = CreateObject("ADODB.Command")

With Command
            .ActiveConnection = GetConnection()
            If .ActiveConnection Is Nothing Then Exit Sub

            .CommandText = "TrackClaim"
            .CommandType = adCmdStoredProc
            .Parameters.Append.CreateParameter("ActivationPlan", adVarChar, adParamInput, 3, Left(ActivationPlan, 3))
            .Parameters.Append.CreateParameter("ClaimNumber", adVarChar, adParamInput, 14, Left(ClaimNumber, 14))
            If Not IsNothing(SubscriberNumber) Then .Parameters.Append.CreateParameter("SubscriberNumber", adVarChar, adParamInput, 13, Left(CStr(SubscriberNumber), 13)) Else .Parameters.Append.CreateParameter("SubscriberNumber", adVarChar, adParamInput, 13)
            If Not IsNothing(Status) Then .Parameters.Append.CreateParameter("Status", adVarChar, adParamInput, 64, Left(CStr(Status), 64)) Else .Parameters.Append.CreateParameter("Status", adVarChar, adParamInput, 64, "Undefined")
            If Not IsNothing(Location) Then .Parameters.Append.CreateParameter("Location", adVarChar, adParamInput, 3, Left(CStr(Location), 3)) Else .Parameters.Append.CreateParameter("Location", adVarChar, adParamInput, 3, "")
            .Parameters.Append.CreateParameter("MacroName", adVarChar, adParamInput, 64, Left(MacroTitle, 64))
            If Not IsNothing(Duration) Then .Parameters.Append.CreateParameter("Duration", adSingle, adParamInput, , CSng(Duration)) Else .Parameters.Append.CreateParameter("Duration", adSingle, adParamInput)
            If Not IsNothing(SourceName) Then .Parameters.Append.CreateParameter("SourceName", adVarChar, adParamInput, 128, PathCompact(CStr(SourceName), 128)) Else .Parameters.Append.CreateParameter("SourceName", adVarChar, adParamInput, 128, PathCompact(ActiveWorkbook.FullName, 128))
            If Not IsNothing(SourceRow) Then .Parameters.Append.CreateParameter("SourceRow", adInteger, adParamInput, , CInt(SourceRow)) Else .Parameters.Append.CreateParameter("SourceRow", adInteger, adParamInput)
            .Execute()
        End With



Is This A Good Question/Topic? 0
  • +

Replies To: Late Binding Error Converting VB6 to VB.NET

#2 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1162
  • View blog
  • Posts: 4,444
  • Joined: 02-July 08

Re: Late Binding Error Converting VB6 to VB.NET

Posted 13 December 2013 - 11:22 AM

CreateObject is the culprit here. I think you need to move to ADO.Net!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1