[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[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!

8.0

VB.Net 2005

Asked by 2004hummer in Visual Studio

Tags: 2005, file

Hello,

Here is my code:

Imports System
Imports System.IO
Imports System.Diagnostics
Imports APS.Infrastructure
Imports System.Data.SqlClient
Imports cltComps

Public Class Presort
    Dim dsResult As Integer
    Private Function AndNotLineIndexOf(ByVal line As String, ByVal SearchFor As String)
        Dim TotalPieces As Integer
        Dim NumPieces As Integer
        Dim Rate As Integer
       


        If line.IndexOf(SearchFor) > 0 Then 'And Not line.IndexOf("POSTAGE STATEMENT") > 0 Then
           


            TotalPieces = CType(line.Substring(94, 10), Integer)
            Rate = line.Substring(94, 10)
            NumPieces = line.Substring(94, 10)
        End If
        Return dsResult
    End Function
    Public Function ReadFile(ByVal Path As String)
        Dim dsResult As Integer
        Dim fs As FileStream = New FileStream(Path, FileMode.Open, FileAccess.Read, FileShare.Read)
        Dim sr As StreamReader = New StreamReader(fs)
        Dim line As String
        Dim TotalPieces, NumPieces, Rate As Integer

        Try
            Do While sr.Peek() >= 0

                line = sr.ReadLine()
                TotalPieces = AndNotLineIndexOf(line, "A3 3-Digit")
                AndNotLineIndexOf(line, "A2 5-Digit")
                AndNotLineIndexOf(line, "A4 AADC")

            Loop
        Catch ex As Exception

        Finally
            If Not sr Is Nothing Then
                sr.Close()
            End If
            If Not fs Is Nothing Then
                fs.Close()
            End If

        End Try
        Return dsResult
    End Function




Here is where I am stuck and need help…

I am trying to parse data from a text file.

I am wanting the values from line 106….

In the file the field/ row called A1…which is column 3-4
I want the value to pull for this field for this which is column 6-12 and it will be inserted into my database table field called A1Desc


Next, for the same line field/ row called A1 I wann the value to pull for columns 46-50 and it will be inserted into my database table field called A1Rate



Here is my stored procedure to give an idea of where I am going with this:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go



ALTER PROCEDURE [dbo].[UpdatePostageAnalysis]
      (
            @ProcessID                              char(5),
            @A1Desc                              char(20),
            @A1Rate                              decimal(19,4),
            @A1Pieces                              int,
            @A1Total                              decimal(19,4),
            @A2Desc                              char(20),
            @A2Rate                              decimal(19,4),
            @A2Pieces                              int,
            @A2Total                              decimal(19,4),
            @A3Desc                              char(20),
            @A3Rate                              decimal(19,4),
            @A3Pieces                              int,
            @A3Total                              decimal(19,4),
            @A4Desc                              char(20),
            @A4Rate                              decimal(19,4),
            @A4Pieces                              int,
            @A4Total                              decimal(19,4),
            @A5Desc                              char(20),
            @A5Rate                              decimal(19,4),
            @A5Pieces                              int,
            @A5Total                              decimal(19,4),
            @PartAPieces                        int,
            @PartATotal                        decimal(19,4),
            @PartAFullTotal                  decimal(19,4),
            --@sC1Desc                              char(20),
            --@dC1Rate                              decimal(19,4),
            --@iC1Pieces                              int,
            --@dC1Total                              decimal(19,4),
            --@sC2Desc                              char(20),
            --@dC2Rate                              decimal(19,4),
            --@iC2Pieces                              int,
            --@dC2Total                              decimal(19,4),
            ---@sC3Desc                              char(20),
            --@dC3Rate                              decimal(19,4),
            --@iC3Pieces                              int,
            ---@dC3Total                              decimal(19,4),
            --@sC4Desc                              char(20),
            --@dC4Rate                              decimal(19,4),
            ---@iC4Pieces                              int,
            ---@dC4Total                              decimal(19,4),
            ---@iPartCPieces                        int,
            ---@dPartCTotal                        decimal(19,4),
            --@dPartCFullTotal                  decimal(19,4),
            --@dTotalMailingAmount            decimal(19,4),
            ---@dTotalFullMailingAmount      decimal(19,4),
            @TotalPieces                        int
            --@iBillingID                              int
      )
AS
      UPDATE PostageAnalysis
            SET
             A1Desc=@A1Desc, A1Rate=@A1Rate, A1Pieces=@A1Pieces, A1Total=@A1Total,
             A2Desc=@A2Desc, A2Rate=@A2Rate, A2Pieces=@A2Pieces, A2Total=@A2Total,
             A3Desc=@A3Desc, A3Rate=@A3Rate, A3Pieces=@A3Pieces, A3Total=@A3Total,
             A4Desc=@A4Desc, A4Rate=@A4Rate, A4Pieces=@A4Pieces, A4Total=@A4Total,
             A5Desc=@A5Desc, A5Rate=@A5Rate, A5Pieces=@A5Pieces, A5Total=@A5Total,
             PartAPieces=@PartAPieces, PartATotal=@PartATotal, PartAFullTotal=@PartAFullTotal,
             TotalPieces=@TotalPieces
            WHERE ProcessID = @ProcessID
RETURN




I need my VB code modified to get me started on what I am trying to do and I should be able to take it from there to parse the rest of the data.

Thanks for the help.
[+][-]05/02/07 09:59 PM, ID: 19021139Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Visual Studio
Tags: 2005, file
Sign Up Now!
Solution Provided By: FernandoSoto
Participating Experts: 1
Solution Grade: A
 
[+][-]05/02/07 10:39 AM, ID: 19017770Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/02/07 10:59 AM, ID: 19017905Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/02/07 11:26 AM, ID: 19018104Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/02/07 12:34 PM, ID: 19018628Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/02/07 01:37 PM, ID: 19019137Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/02/07 01:45 PM, ID: 19019201Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/03/07 07:10 AM, ID: 19023357Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/03/07 01:35 PM, ID: 19026695Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/03/07 01:38 PM, ID: 19026720Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93