Need help with Basic code and opening an ODBC data connection

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help with Basic code and opening an ODBC data connection

    Hey Guys!

    Wondering if anyone has any input on the following code.

    I am using the basic script to make a new odbc data connection but I am not sure if I have the correct syntax.



    Dim MyCon As New Odbc.OdbcConnection
    MyCon.ConnectionString = "Driver={PostgreSQL ANSI};database=STONE_ERP;server=erpsvr1;port=5432; uid=postgres;sslmode=disable;readonly=0;protocol=7 .4;User ID=postgres;password=xxxx;"

    MyCon.Open()
    If MyCon.State = ConnectionState.Open Then
    MsgBox("Connected To PostGres", MsgBoxStyle.MsgBoxSetForeground)
    End If
    MyCon.Close()




    It is not connecting and or responding and driving me a bit mad.

    Any thoughts on what I am doing wrong?

    Thanks in advance.

  • #2
    BEFORE YOU TRY ANYTHING:
    double check your connection string! Noticed a space between 7[space is here].4

    What syntax are we looking at, is this a VB.Net app? If so change line to:
    Code:
    Dim ConStr As String = "Driver={PostgreSQL ANSI};database=STONE_ERP;server=erpsvr1;port=5432; uid=postgres;sslmode=disable;readonly=0;protocol=[COLOR=#d35400][B]7 .4[/B][/COLOR];User ID=postgres;password=xxxx;"
    Dim MyCon As New OdbcConnection(ConStr)
    MyCon.Open()
    I've got some MySQL api experience but can't imagine it being totally different than any other database. I also use C++ for that, so I might miss something in translating to VB.Net... let us know if it works for you.
    Last edited by Kp61dude!; 05-19-2020, 12:55 PM.
    PcDmis 2015.1 SP10 CAD++
    Global 7-10-7 DC800S

    Comment


    • nferris
      nferris commented
      Editing a comment
      Well I am using the Basic syntax that PC DMIS uses.

      I have a reference library but it does not have any odbc connection topics.

      I did verify the connection string as i tried it with space and without.

  • #3
    Reply to comment #2.1:

    I've never used a reference library with the Basic Script editor equipped in PcDmis, I don't know if it works.
    PcDmis 2015.1 SP10 CAD++
    Global 7-10-7 DC800S

    Comment

    Related Topics

    Collapse

    Working...
    X