Advertisement

03.03.2008 at 10:57PM PST, ID: 23211865
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Read sql data and write an output txt file in vb.net

Hi, support team:

I have a xml-txt already received the data (part2 below), but right now I need to write a new vb.net program use SQLDataReader to read the data from SQL server and StreamWriter output txt file (part1 below), I need a help for the following and correct my part2 syntax.  

1) when to use SqlDataReader.GetString () and SqlDataReader.GetInt32() method to retrieve the field?
2) GetValue() and GetOrdinal() method?
3).ToString() method?    
any help is very appreciated, thanks! (hope I made my question clear)

'part1 - Is this the right code?
***********************************
Dim strRecordType As String = sdr.GetValue(sdr.GetOrdinal("RecordType")).ToString
Dim intDocumentNo As Integer = sdr.GetValue(sdr.GetOrdinal("DocumentNo")).GetInt32

strExpDelim="|"
swOutput.Write("H" _
                        + strExpDelim + intPONum.ToString _
                        + strExpDelim + strOrderDate _
                        + strExpDelim + strRecordType _
                        + strExpDelim + intDocumentNo _
                        + vbCrLf)

'part2 - read the xml convert to txt
*****************************************
     Dim filename As String
     filename = "C:\test.xml"
     Dim m_xmlr As XmlTextReader
     m_xmlr = New XmlTextReader(filename)
     m_xmlr.WhitespaceHandling = WhitespaceHandling.None
 
     While Not m_xmlr.EOF
     m_xmlr.Read()
     If Not m_xmlr.IsStartElement() Then
     Exit While
     End If
     m_xmlr.Read()
     Dim RecordType = m_xmlr.ReadElementString("RecordType")
     Dim DocumentNo = m_xmlr.ReadElementString("DocumentNo")
     Dim OrderDate = m_xmlr.ReadElementString("OrderDate")
     Dim Title = m_xmlr.ReadElementString("Title")
     Dim Currency = m_xmlr.ReadElementString("Currency")

     Dim ExportTxtFile As String = "C:\test.txt"
     Dim File_Stream As New FileStream(ExportTxtFile , FileMode.Append, FileAccess.Write)
     Dim FileWriter As New StreamWriter(File_Stream)
     With FileWriter
     Try
     .BaseStream.Seek(0, SeekOrigin.End)
     .WriteLine(RecordType _
     & "|" & DocumentNo & "|" _
     & OrderDate & "|" & Title & "|" & Currency)
     Catch ex As IOException
     Debug.Assert(False, ex.ToString)
     Finally
     .Close()
     End Try
     End With
     End While
     m_xmlr.Close()
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: vesnahu
Solution Provided By: gnoon
Participating Experts: 1
Solution Grade: A
Views: 154
Translate:
Loading Advertisement...
03.04.2008 at 01:31AM PST, ID: 21039414

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.04.2008 at 08:30AM PST, ID: 21042441

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.04.2008 at 06:44PM PST, ID: 21047295

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.04.2008 at 06:48PM PST, ID: 21047306

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.04.2008 at 06:51PM PST, ID: 21047314

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.07.2008 at 01:12PM PST, ID: 21074177

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.09.2008 at 06:46PM PDT, ID: 21083617

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080236-EE-VQP-29 / EE_QW_2_20070628