none
Project must cater to 64-bit users (SQL database) and 32-bit users (Access 2003 database) RRS feed

  • Question

  • What code would I use that the system should detect if the project is set to 64-bit or 32-bit?
    Thursday, January 23, 2020 9:32 PM

Answers

  • Try this

    If IntPtr.Size = 8 Then
    ' 64 bit machine
    ElseIf IntPtr.Size = 4 Then
    ' 32 bit machine
    End If


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by MosheS Singer Sunday, January 26, 2020 5:57 PM
    Thursday, January 23, 2020 10:21 PM
    Moderator

All replies

  • Best to have one source and do a batch build with different configurations.

    EDIT:

    There can be many reasons why a app should be 32 or 64 bit. Now if you are working with OleDb data provider most apps can run  using the following setting

    Now can you say why this might not work for you in regards to platform "Any CPU" and Prefer 32-bit ? Do you work with specific Office drivers that differ on different machines?


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange


    Thursday, January 23, 2020 9:52 PM
    Moderator
  • I am trying to find a code that will be able to detect if the system is set to 32 or 64 bit, for example

    the following code to convert and encrypt in XML.

    If the system is 64-bit then run

    Dim encryptedBytes() As Byte = Convert.FromBase64String(encryptedtext)

    Else 

    Dim encryptedBytes() As Byte = Convert.FromBase32String(encryptedtext)

    end if

    Thursday, January 23, 2020 10:05 PM
  • I am trying to find a code that will be able to detect if the system is set to 32 or 64 bit, for example

    the following code to convert and encrypt in XML.

    If the system is 64-bit then run

    Dim encryptedBytes() As Byte = Convert.FromBase64String(encryptedtext)

    Else 

    Dim encryptedBytes() As Byte = Convert.FromBase32String(encryptedtext)

    end if

    And how does that relate to  Access 2003 ???

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Thursday, January 23, 2020 10:15 PM
    Moderator
  • Try this

    If IntPtr.Size = 8 Then
    ' 64 bit machine
    ElseIf IntPtr.Size = 4 Then
    ' 32 bit machine
    End If


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by MosheS Singer Sunday, January 26, 2020 5:57 PM
    Thursday, January 23, 2020 10:21 PM
    Moderator