import data from folder to database with several fields.

dhruvdubey

New member
Joined
Feb 5, 2007
Messages
2
Programming Experience
Beginner
import the data from the folder to the database thru vb.net that have several fields.
 
Please be more descriptive on your question. Do you have a fixed length file in a folder and you need to upload the data in this file into a database? If this is the case, you can read the file into a String, then parse out your variables, then create your SQL statement with the variables created.

Example

If you have a file that has all your data in a fixed length and each line is a row to be inserted into the db, then

VB.NET:
Dim file As New System.IO.StreamReader(PATH)
Dim content As String = file.ReadToEnd()
file.Close()
Dim rows() As String = content.Split(vbCrLf.ToCharArray())
For i As Integer = LBound(rows) To UBoound(rows) - 1
[INDENT]Dim column1 As String = rows(i).Substring(beginning, end)
Dim column2 As String = rows(i).Substring(beginning, end)
Dim column3 As String = rows(i).Substring(beginning, end)
etc....
 
SQLSelect("INSERT INTO TABLE VALUES('" & column1 & "','" & column2 & "','" & column3 ...")
[/INDENT]End For
 
Back
Top