简体   繁体   中英

DART SQL How do I read multiple row values (with multiple columns) from SQL query results in Dart?

Right now i am able to read data from the column in the single returned row ad below

    var resultsDoc = await conn
      .query('select fNAME, SPECIALITY, CATENAME from doctor where id = ?', [5]);
  for (var rowDoc in resultsDoc) {    
      ffname = rowDoc[0];      //reading value at column 1
      sspeciality = rowDoc[1];         //reading value at column 2
      ccategory = rowDoc[2];    //reading value at column 3
  }

what if i wanted to return the entire table as below enter image description here

Team, assist on how to read those values.

Thank You

You were close!

for (var rowDoc in resultsDoc) {
  print(rowDoc.join('\t'));    
}

Or did you want to transpose the list of lists, so that you'd have 3 lists, one for each column?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM