Hello.
I did not understand Have you got table (your employee datatable)?
You must to take data to dataset from database.
For example you have got table in the dataset. The name of this table is "Employee".
I am sure next code will give you result.
dim _streamWriter as StreamWriter
dim _table as DataTable = _dataSet.Tables("Employee")
'Check table. If table has is not nothing and has any records you will write rows to text file.
if _table isnot nothing andalso _table.Rows.Count > 0 then
_streamWriter = New System.IO.StreamWriter(myFileName)
for each _row as DataRow in _table.Rows
Dim _name as String = _row.Item("Name")
Dim _id as String = _row.Item("ID").ToString()
Dim _add as string = _row.Item("Add")
Dim _dob as string = Format(_row.Item("dob"), "dd/MM/yyyy")
_streamWriter.WriteLine(_Name & " " & _id & " " & _add & " " & _dob)
Next
_streamWriter.Close()
end if
could you give a more specific example on how to retrieve from the table example employee table
name id add dob
JOHN 23 street 1 23/07/1980
TOMY 20 street 4 11/03/1979
and in the text file i want the record to be exectly the same
JOHN 23 street1 23/07/1980
TOMY 20 street 4 11/03/1979
how should i do this?
thanks