.net - Writing a text file -


I am using VB.NET and, I want to write a text file from the database.

Open a text file, read data from the database and then type in the text file.

code.

  cmd = New SqlCommand ("Select ID, Name," from the table ", con) dr = cmd.ExecuteReader while DR.Read () Dim Data String Data = File As ReadAllText (dr.Item ("PersonID")) File.WriteAllText ("D: \ test.txt", data) end  

The above code is showing error, how to write a text file

VB.NET code help

In your code you are not actually in the database Try reading this:

  author = new streamer ("D: \ test.txt") using Dr. Reed () slow down D = dr.GetInt32 (0) Dim Names = dr.GetString () 1) Dim Dept = dr.GetString (2) Writer. WriteLine (String.Format ("{0} {1} {2}", ID, name , Department) Using End End  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -