0

When connecting to a Sybase ASE database via ODBC using the code below, I'll occasionally get a '[IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed' error.

Can this be caused by my code? I read here that I should be using the 'With' statement instead, but I don't understand how that would affect this.

Thanks in advance!

    Try
        odsConn.Open()
        Dim acctCheckString As String = sB.ToString
        Dim odsCmd As New OdbcCommand(acctCheckString, odsConn)

        odsRtrn = CStr(odsCmd.ExecuteScalar).TrimEnd
    Catch ex As Exception
        odsRtrn = ex.Message.ToUpper
        odsRtrn = CheckError(odsRtrn)
    Finally
        odsConn.Close()
    End Try
Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
gibbo
  • 367
  • 2
  • 4
  • 15

1 Answers1

0

I apologize for interjecting without an answer to your specific question, but if I might make a suggestion...

In the year 2009, if you are using vb.Net, and you are still using ODBC, you should please (seriously) check out ADO.Net managed code data providers. There is one for Sybase...

SyBase ADO.Net Providers

This will completely replace the odbc libraries. they are much easier to use.

Charles Bretana
  • 143,358
  • 22
  • 150
  • 216
  • Those look awesome, thanks. I'll see if I can convince my boss, but it may prove difficult :( – gibbo Dec 09 '09 at 16:57
  • There is also third party driver from DataDirect... http://www.datadirect.com/products/net/net_for_sybase/index.ssp I have not used any of these, (not a Sybase person) but I suggest you check them out – Charles Bretana Dec 09 '09 at 17:02
  • Yeah we looked at them originally, but they were a bit too expensive. Thanks again. – gibbo Dec 09 '09 at 17:06