Advertisement

07.21.2008 at 10:35AM PDT, ID: 23582640
[x]
Attachment Details

Mass loading in Visual Studio 2008 (VB) not working. Data is not loaded to DB

Asked by Goofytouy in Visual Studio 2008

Tags: visual studio, database, access

Hi experts!
I'm making my first works in Visual Studio 2008; i'm an old school guy, that "'til yesterday" was programming with Visual Basic 6...Some things have changed a lot, and I'm missing data controls a lot right now...
I have the following trouble:
I have a button that once given a csv file with 28 fields (filename is loaded at runtime), and clicked, should be loaded into several tables of an Access DB.
I've developed the folowing code, based primarily on MSDN documentation. So far so good, it does not have any compiling errors, filed parsing is done ok but...
No new records are opened in the DB, data is not populated and modifications (if done) are not saved.
I've used (removed from this code) the Rowchanging event to trap the information that was going to be loaded, and info is ok. No errors are threw at runtime moment. All records in textfile are read.
DB tables, remain at 0 records. What could be wrong?
OS: Windows XP SP2
VS: Visual Studio 2008 Standard Edition (Evaluation version)

I'll appreciate your input
Goofy

Start 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:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim campos(28) As String
        Dim control As Integer
        Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(TextBox1.Text)
            MyReader.TextFieldType = FileIO.FieldType.Delimited
            MyReader.SetDelimiters(";")
            Dim currentRow As String()
            While Not MyReader.EndOfData
                Try
                    currentRow = MyReader.ReadFields()
                    Dim currentField As String
                    control = 0
                    For Each currentField In currentRow
                        campos(control) = currentField
                        control = control + 1
                        Console.WriteLine(control)
                    Next
                    Dim RegIdentificacion As BDLRDataSet.IdentificacionRow
                    RegIdentificacion = BDLRDataSet.Identificacion.NewRow
                    RegIdentificacion.Rut = campos(0)
                    RegIdentificacion.Nombre = campos(1)
                    RegIdentificacion.RED = campos(19)
                    BDLRDataSet.Identificacion.Rows.Add(RegIdentificacion)
                    BDLRDataSet.Identificacion.AcceptChanges()
 
                    Dim RegDBS_Cl As BDLRDataSet.DBS_ChiRow
                    RegDBS_Cl = BDLRDataSet.DBS_Chi.NewRow
                    RegDBS_Cl.RUT = campos(0)
                    RegDBS_Cl.R1M = campos(2)
                    RegDBS_Cl.R10 = campos(3)
                    RegDBS_Cl.R12 = campos(4)
                    RegDBS_Cl.R18 = campos(5)
                    RegDBS_Cl.R27 = campos(6)
                    RegDBS_Cl.R39 = campos(7)
                    RegDBS_Cl.R40 = campos(8)
                    RegDBS_Cl.R41 = campos(9)
                    BDLRDataSet.DBS_Chi.Rows.Add(RegDBS_Cl)
                    BDLRDataSet.DBS_Chi.AcceptChanges()
 
                    Dim RegDBS_Ar As BDLRDataSet.DBS_ArgRow
                    RegDBS_Ar = BDLRDataSet.DBS_Arg.NewRow
                    RegDBS_Ar.Rut = campos(0)
                    RegDBS_Ar.R05 = campos(10)
                    RegDBS_Ar.R06 = campos(11)
                    RegDBS_Ar.RBP = campos(12)
                    BDLRDataSet.DBS_Arg.Rows.Add(RegDBS_Ar)
                    BDLRDataSet.DBS_Arg.AcceptChanges()
 
                    Dim RegIAS As BDLRDataSet.IASRow
                    RegIAS = BDLRDataSet.IAS.NewRow
                    RegIAS.RUT = campos(0)
                    RegIAS.R1M = campos(20)
                    RegIAS.R10 = campos(21)
                    RegIAS.R12 = campos(22)
                    RegIAS.R18 = campos(23)
                    RegIAS.R27 = campos(24)
                    RegIAS.R39 = campos(25)
                    RegIAS.R40 = campos(26)
                    RegIAS.R41 = campos(27)
                    BDLRDataSet.IAS.Rows.Add(RegIAS)
                    BDLRDataSet.IAS.AcceptChanges()
 
 
                    Dim Compras_Bo As BDLRDataSet.Compras_BoRow
                    Compras_Bo = BDLRDataSet.Compras_Bo.NewRow
                    Compras_Bo.Rut = campos(0)
                    Compras_Bo.Userid = campos(16)
                    BDLRDataSet.Compras_Bo.Rows.Add(Compras_Bo)
                    BDLRDataSet.Compras_Bo.AcceptChanges()
 
 
                    Dim Compras_Cl As BDLRDataSet.Compras_ClRow
                    Compras_Cl = BDLRDataSet.Compras_Cl.NewRow
                    Compras_Cl.Rut = campos(0)
                    Compras_Cl.Userid = campos(17)
                    BDLRDataSet.Compras_Cl.Rows.Add(Compras_Cl)
                    BDLRDataSet.Compras_Cl.AcceptChanges()
 
 
                    Dim Compras_Uy As BDLRDataSet.Compras_UyRow
                    Compras_Uy = BDLRDataSet.Compras_Uy.NewRow
                    Compras_Uy.Rut = campos(0)
                    Compras_Uy.Userid = campos(18)
                    BDLRDataSet.Compras_Uy.Rows.Add(Compras_Uy)
                    BDLRDataSet.Compras_Uy.AcceptChanges()
 
                Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
                    MsgBox("Linea " & ex.Message & "no es valida y no será cargada.")
                End Try
            End While
        End Using
        CheckBox1.Checked = vbYes
        CheckBox1.Refresh()
    End Sub
[+][-]07.22.2008 at 03:43AM PDT, ID: 22057781

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.

 
[+][-]07.22.2008 at 04:34AM PDT, ID: 22058177

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.

 
[+][-]07.22.2008 at 09:06AM PDT, ID: 22060844

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.

 
[+][-]07.22.2008 at 03:06PM PDT, ID: 22064150

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.

 
[+][-]07.22.2008 at 03:19PM PDT, ID: 22064236

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.

 
[+][-]07.22.2008 at 03:24PM PDT, ID: 22064263

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.

 
[+][-]07.22.2008 at 03:46PM PDT, ID: 22064387

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.

 
[+][-]07.22.2008 at 04:15PM PDT, ID: 22064558

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.

 
[+][-]07.22.2008 at 05:00PM PDT, ID: 22064809

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.

 
[+][-]07.24.2008 at 04:32AM PDT, ID: 22077893

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.

 
[+][-]07.24.2008 at 06:20AM PDT, ID: 22078767

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.

 
[+][-]07.24.2008 at 08:09AM PDT, ID: 22080010

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.

 
[+][-]07.24.2008 at 09:50AM PDT, ID: 22081160

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.

 
[+][-]07.27.2008 at 01:02PM PDT, ID: 22099394

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

Zone: Visual Studio 2008
Tags: visual studio, database, access
Sign Up Now!
Solution Provided By: Goofytouy
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906