none
problem with View RRS feed

  • Question

  • Hello everyone.

    I have a problem qith my query.

    Problem is when I am making normal query:

    Code Block

    select * from dbtest..tab_log

    OdbcDataReader myReader = null;
    OdbcCommand myCommand = new OdbcCommand(query, MyConnection);
    myReader = myCommand.ExecuteReader();


    while (myReader.Read())
    {
    MessageBox.Show(myReader["ID"].ToString());
    }



    Everything is working. But when I change my line:
    Code Block

    select * from dbtest..tab_log


    to working with view:
    Code Block

    select * from dbtest..v_tab_log_1



    Then I can't read anything.
    I don't have any massege, so it looks like he is seeing this view.

    When I make query on directly in database then I have identical results from both query.

    I will be very gratful for answer on this problem :/
    Thursday, December 13, 2007 11:42 AM

All replies

  • It sounds like the problem is in the query itself or the connection object.  Can you post the complete code for the query?  Also, have you checked that the new view is on the same database as the table?  Does the connection string need to be modified?
    Thursday, December 13, 2007 1:17 PM
  • Here is my main method in form:

    Code Block

    public SMAAudyt(string driver, string server, string database, string login, string pass)
    {
                DRIVER = driver;
                SERVER = server;
                DATABASE = database;
                LOGIN = login;
                PASS = pass;

    MyConnection = new OdbcConnection("DRIVER={" + DRIVER + "};SERVER=" + SERVER + ";DATABASE=" + DATABASE + ";UID=" + LOGIN + ";PWD=" + PASS + "");

                InitializeComponent();
    }


    I don't know if you need anything more?

    View is in this same database as the table.

    I have check both query in QueryAnalayzer and they have identic results (of course column names are also this same).
    Thursday, December 13, 2007 1:29 PM