i am developing an application where i have to break a stream of numbers which are in .txt file and save it into access database.I need to know how to do this in visual basic.I have created a database at runtime and also created table with required fields but am not able to break and save it!!there is an appe command in foxpro through which u can break a file and can save into tables.But in VB there is nothing like that.Please help!!!!

Recommended Answers

All 3 Replies

Can you post a sample of the data you are trying to parse and the code you have so far? That would be a good start

Can you post a sample of the data you are trying to parse and the code you have so far? That would be a good start

.

123456666666666065467272727272772828282828
646648484848488484848484848484848488484826
095765037366100089366343048747589585757575
737838393939939393303003306784652028327549

the first six digits are for bank1,2nd 6 digits are bank2,third 8 digits are for checkno and like wise.I need to break this file and save it into access database at runtime!i am able to create database and table at runtime but how do i break this so that it fits in my fields in database(bank1,bank2,checkno...)

This will get the values in to variables where you can do whatever you need on the data access end:

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
		Dim lines As List(Of String) = New List(Of String)
		lines.AddRange(System.IO.File.ReadAllLines("C:\file.txt"))

		For Each line In lines
			Dim bank1 As String = line.Substring(0, 6)
			Dim bank2 As String = line.Substring(6, 6)
			System.Diagnostics.Debugger.Break()
		Next
	End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.