views:

66

answers:

1

Hello,

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
A: 

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
Those look awesome, thanks. I'll see if I can convince my boss, but it may prove difficult :(
gibbo
There is also third party driver from DataDirect... http://www.datadirect.com/products/net/net_for_sybase/index.sspI have not used any of these, (not a Sybase person) but I suggest you check them out
Charles Bretana
Yeah we looked at them originally, but they were a bit too expensive. Thanks again.
gibbo