| | |
text file contains non delimited data into access database
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2008
Posts: 5
Reputation:
Solved Threads: 0
I have a text file contains non delimited data
(Each row consists from 16 fields and has a 131 byte)
I used this code to load it's data into datagrid(I have visual basic 2005)
The program work fine
Now I want load this datagrid into access database
I try to define a table adaptor define at the same dataset contains the access table with the same definition of the column of the datagrid of the textfile
and I try to bind the data loading from text file to this new datatable but my problem this file never show to me anydata
Can anybody help me please?
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DataGridView1.AutoGenerateColumns = True
Dim TextFieldParse As New FileIO.TextFieldParser("C:\txtFilesFolder\tsticd9.txt") tfp.TextFieldType = FileIO.FieldType.FixedWidth
tfp.FieldWidths = New Integer() {6, 7, 29, 1, 10, 6, 7, 9, 9, 13, 15, 3, 4, 9, 2, -1}
TextFieldParser.HasFieldsEnclosedInQuotes = False
While Not TextFieldParse.EndOfData
Dim valstring() As String = TextFieldParse.ReadFields
Dim datarow1 As DataSet1.DataTable1Row
datarow1 = DataSet11.DataTable1.NewDataTable1Row
For i As Integer = 0 To valstring.Length - 1
If valstring (i).Trim.Length > 0 Then
dr.Item(i) = valstring (i)
End If
Next
DataSet11.DataTable1.AddDataTable1Row(dr)
End While
BindingSource1.DataSource = DataSet11
BindingSource1.DataMember = "DataTable1"
End Sub
End Class
(Each row consists from 16 fields and has a 131 byte)
I used this code to load it's data into datagrid(I have visual basic 2005)
The program work fine
Now I want load this datagrid into access database
I try to define a table adaptor define at the same dataset contains the access table with the same definition of the column of the datagrid of the textfile
and I try to bind the data loading from text file to this new datatable but my problem this file never show to me anydata
Can anybody help me please?
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DataGridView1.AutoGenerateColumns = True
Dim TextFieldParse As New FileIO.TextFieldParser("C:\txtFilesFolder\tsticd9.txt") tfp.TextFieldType = FileIO.FieldType.FixedWidth
tfp.FieldWidths = New Integer() {6, 7, 29, 1, 10, 6, 7, 9, 9, 13, 15, 3, 4, 9, 2, -1}
TextFieldParser.HasFieldsEnclosedInQuotes = False
While Not TextFieldParse.EndOfData
Dim valstring() As String = TextFieldParse.ReadFields
Dim datarow1 As DataSet1.DataTable1Row
datarow1 = DataSet11.DataTable1.NewDataTable1Row
For i As Integer = 0 To valstring.Length - 1
If valstring (i).Trim.Length > 0 Then
dr.Item(i) = valstring (i)
End If
Next
DataSet11.DataTable1.AddDataTable1Row(dr)
End While
BindingSource1.DataSource = DataSet11
BindingSource1.DataMember = "DataTable1"
End Sub
End Class
![]() |
Similar Threads
- How to extract data from web databases? (Database Design)
Other Threads in the VB.NET Forum
- Previous Thread: dataset mysteriously clearing for no apparent reason...
- Next Thread: VC++ application Convert to VB.NET
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net 2005 2008 access account application arithmetic array arrays basic bing button buttons c# center check checkbox code combobox component convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor ms net networking objects output passingparameters peertopeervideostreaming picturebox picturebox1 port print printing problem problemwithinstallation project remove save searchbox searchvb.net select serial server shutdown soap sorting survey table tcp temperature text textbox timer toolbox trim update updown user validation vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf





