Read data from the SQL table to the text

xiaoxiao2021-03-06  55

USING (streamwriter sw = new streamwriter ("testfile.txt"))

{

// Add some text to the file.

// Traverse DataSet11,

Foreach (System.Data.DataRow Row in DataSet11.tables [0] .rows)

{

// Traverse each column of the current row, if you do not output a field value for the flight, otherwise, "", "

For (int coL = 0; col

{

IF (! (row [col) is system.dbnull)

{

SW.WRITE (Row [col] .tostring ());

}

SW.WRITE (",");

}

SW.WRITELINE ("");

}

}

转载请注明原文地址:https://www.9cbs.com/read-116955.html

New Post(0)