C# connect Progress Database Error

Discussão em 'StackOverflow' iniciado por fdantas, Dezembro 8, 2015.

  1. fdantas

    fdantas Administrator Moderador

    I want to connect progress database in local with c#.

    my c# code is:

    string connectionString = "DSN=OpenEdge Wire Protocol;Host = localhost; DB = E:\\programs\\DBs\\TrDB\\trnakdb; UID = connuser; PWD = 123456; PORT = 11112";
    DataTable dt = new DataTable();
    int rows;

    using (OdbcConnection connection = new OdbcConnection(connectionString))
    using (OdbcCommand command = connection.CreateCommand())
    using (OdbcDataAdapter adapter = new OdbcDataAdapter(command))
    {
    connection.Open();
    command.CommandText = "SELECT * FROM PUB.FTTEFBAS";
    rows = adapter.Fill(dt);
    }

    Console.WriteLine("adapter.Fill() returned {0}", rows);
    Console.WriteLine("The data table contains {0} rows and {1} columns.",
    dt.Rows.Count,
    dt.Columns.Count
    );
    foreach (DataRow dataRow in dt.Rows)
    {
    string babili = dataRow.ItemArray.ToString()+"####";
    for (int key = 0; key < dataRow.ItemArray.Length; ++key)
    babili += "\t" + key + "=>" + dataRow.ItemArray[key];

    Console.WriteLine(babili);
    }


    But it gives error:

    System.Data.Odbc.OdbcException (0x80131937): ERROR [HY000] [DataDirect][ODBC Progress OpenEdge Wire Protocol driver][OPENEDGE]Access denied (Authorisation failed) (7512)


    I can connect with progress data dictinary or data administration tools with this username.

    If I try select system tables, no errors occur. But when I try to list any table from PUB schema, it gives error.

    Thanks

    M. Yasin Birer

    Continue reading...

Compartilhe esta Página