Read a row (SQL)

Discussion in 'Questions (Windows Mobile)' started by Nkieto, May 1, 2007.

  1. Nkieto

    Nkieto Member Licensed User

    I have a query (SELECT), and I am using Command.ExecuteTable for showing rows in a table. After that, I want to select one row, click a button and show another form with detailed information for this row.

    I am using Table.SelectedRow for determine which row is selected, but I don't know how to query my row. I mean, I know the INDEX in the table, but I can't use DataReader.GetValue or DataReader.ReadNextRow to select my row.

    Any idea? I am looking for something in the way ReadRow(INDEX)... Do you know what I mean???

    PD.- Sorry for asking so many things, but I have just discover Basic4PPC, and I am enjoying a lot, doing more things in two days than using SprintDB in months.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    First, I'd like to say :sign0098: for the nice links.

    Using Table.Cell you can get the primary key of the selected row.
    Now you can query again (ExecuteReader) using the primary key.
    You will get a result of one row, and using a DataReader you will be able to get the data.
     
  3. Nkieto

    Nkieto Member Licensed User

    Thanks Erel, I think that could be a good and clean solution.

    I have decide not to use Command.ExecuteTable, because I need to SELECT ID from my sql table, but I don't want to show it on the form table. Then, I am using a manual fill for the table (Command.ExecuteReader, Reader.Value, Reader.ReadNextRow, Table.AddRow, ...).

    Then I use Table.AddCol(cString, "ID", 0), and in this way I have all information for ID for future use, but I am not showing col in the table.

    Thanks Erel.
     
Loading...