Advertisement

08.29.2008 at 10:14AM PDT, ID: 23689489
[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!

9.1

csv dlelimiter

Asked by StewSupport in MS SQL Server, Microsoft Visual Basic.Net, .NET Framework 2.x

hi guys, i have a csv file that use looks like this
"INVOICE#,""CUSTOMER#"",""CUSTOMER CITY"",""ORDER"",""SHIP DATE"",""PO NUMBER"",""INVOICE DATE"",""INVOICE AMT"",""CASH DISC %"",""CASH DISC AMT"",""LINE#"",""ITEM#"",""QTY ORDERED"",""U/M"",""QTY SHIPPED"",""ITEM DESC1"",""ITEM DESC2"",""PACK"",""UNIT PRICE"",""TOT PRICE"""
"10629794,82969211,""DANBURY"",""93933"",80829,""674311"",8292008,279.22,3.000,8.38,1,""079286193"",5,""CS"",0,""Tray Foam 9x7x1        4S Black"",""Pactiv"",""0500"",18.09,0.00"
what i have from the other post was this piece of code that help me read the file. But if i put the "" in the delimiter it will crashed. how do i do fixt this problem. if my csv file was just this below then the code below will work:
here is the working text file content.
INVOICE#,CUSTOMER#,CUSTOMER CITY,ORDER,SHIP DATE,PO NUMBER,INVOICE DATE,INVOICE AMT,CASH DISC %,CASH DISC AMT,LINE#,ITEM#,QTY ORDERED,U/M,QTY SHIPPED,ITEM DESC1,ITEM DESC2,PACK,UNIT PRICE,TOT PRICE
10626428,18775511,NORWALK,91084,80826,Peter,8252008,688.8,3,20.66,1,75131003,20,CS,20,"Pan Round 10          57310-30""",Pactiv,250,34.44,688.8Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
Dim parser As New FileIO.TextFieldParser(fullpath)
                With parser
                    .Delimiters = New String() {","}  'comma delimited
                    .HasFieldsEnclosedInQuotes = True
                    .TrimWhiteSpace = True
                    
                End With
 
                'Create a DataTable to store the data from the file
                '  and to use to update the database
                Dim table As New DataTable()
                Dim line As String() = Nothing
                Do Until parser.EndOfData = True
                    line = parser.ReadFields()
                    If table.Columns.Count = 0 Then
                        'Add a column for each column in the csv file
                        For i As Integer = 0 To line.Length - 1
                            table.Columns.Add(line(i), GetType(String))
                        Next
                    Else
                        'Load the data from the columns
                        table.Rows.Add(line)
                    End If
                Loop
                SQLConnection.Open()
                Dim bulkcopy As New SqlClient.SqlBulkCopy(SQLConnection)
                bulkcopy.DestinationTableName = "Table Name"
                bulkcopy.WriteToServer(table)
                parser.Close()
                parser.Dispose()
[+][-]08.29.2008 at 10:17AM PDT, ID: 22347431

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.29.2008 at 10:19AM PDT, ID: 22347441

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.29.2008 at 10:21AM PDT, ID: 22347458

View this solution now by starting your 7-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

Zones: MS SQL Server, Microsoft Visual Basic.Net, .NET Framework 2.x
Sign Up Now!
Solution Provided By: VBRocks
Participating Experts: 1
Solution Grade: A
 
 
[+][-]08.29.2008 at 11:11AM PDT, ID: 22347862

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.29.2008 at 11:14AM PDT, ID: 22347885

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.29.2008 at 11:46AM PDT, ID: 22348156

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.29.2008 at 11:48AM PDT, ID: 22348170

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.29.2008 at 12:10PM PDT, ID: 22348366

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 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.03.2008 at 07:52AM PDT, ID: 22377901

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080924-EE-VQP-38 / EE_QW_2_20070628