Share via

Converting VBA to VB.NET, getting compile errors on ADO data types

Giacomo Raucci 366 Reputation points
2023-07-19T20:53:15.55+00:00

Below is a snapshot of VBA logic; however, when attempting to port to a VB.NET app, I get compile errors on the ADODB data types (any datatype with prefix of "ad"; e.g., adInteger, etc.)

The web-site below contains the various data types for ADO. Are these data types not valid for VB.NET? Thanks in advance for any help you can provide.

https://www.w3schools.com/asp/ado_datatypes.asp

        cmd = New ADODB.Command
        With cmd
            .ActiveConnection = conn
            .CommandType = adCmdStoredProc
            .CommandText = storedProcName
            .NamedParameters = True
        End With


        param1 = cmd.CreateParameter("ReturnValue", adInteger, adParamReturnValue)
        cmd.Parameters.Append(param1)
Developer technologies | VB
0 comments No comments

Answer accepted by question author

Jiachen Li-MSFT 34,241 Reputation points Microsoft External Staff
2023-07-20T01:52:15.0533333+00:00

Hi @Giacomo Raucci ,

The data type of ADO can be used in vb.net, try DataTypeEnum.adInteger.

Best Regards.

Jiachen Li


If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.