none
How I can Connect to Sybase 12.5 in C# RRS feed

  • Question

  • I want to connect to Sybase 12.5 databse in C#. I use code below:

    using Sybase.Data.AseClient;
    ....
    ....
    //string connectionString =
    //          "Server=10.149.29.5,5000;" +
    //          "Database=BLUE;" +
    //          "User ID=sysadmin;" +
    ///         "Password=123;";
    //            IDbConnection dbcon;


    But the row using Sybase
    Data.AseClient; has a error:

    "Error    1    The type or namespace name 'Sybase' could not be found (are you missing a using directive or an assembly reference?)..."


    I was install Sybase client and added ODBC Datasource.

    Please tell me how to solve this problem.

    ========
    Undynamic
    Friday, November 14, 2008 7:55 AM

Answers

  • Installing Sybase client is not enough. You also need to set reference to the DLL that contains Sybase ASE provider. If I remember correctly that name of the DLL is Sybase.DataAseClient.dll. After the reference is set, your code should compile, but you might get run-time error for some other missing DLL that does not require reference, but needs to be located in bin folder. I do not remember name of that DLL, but you will find it in same folder where Sybase.DataAseClient.dll installed.

    Friday, November 14, 2008 11:44 AM
    Moderator

All replies

  • Installing Sybase client is not enough. You also need to set reference to the DLL that contains Sybase ASE provider. If I remember correctly that name of the DLL is Sybase.DataAseClient.dll. After the reference is set, your code should compile, but you might get run-time error for some other missing DLL that does not require reference, but needs to be located in bin folder. I do not remember name of that DLL, but you will find it in same folder where Sybase.DataAseClient.dll installed.

    Friday, November 14, 2008 11:44 AM
    Moderator
  • Thank you for your reply, I will do that now.

    Otherwise, I just find the other way to connect to the sybase with below, I post this connection string for some one refer when need.

    string con = "Dsn=DatasourceName;uid=username;pwd=password;nln=Winsock;na=servername,portNumber;db=DatabaseName;"

    ============
    undynamicmagic
    Monday, November 17, 2008 8:07 AM