View Single Post
  #3 (permalink)  
Old 03-13-2009, 6:43 AM
cjard's Avatar
cjard cjard is offline
VB.NET Forum All-Mighty
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Apr 2006
Age: 65
Posts: 6,442
Reputation: 807
cjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond reputecjard has a reputation beyond repute
Default

Going along with what Tom said:

Code:
'assumes you have filename  in a string
Dim filebits() as String = filename.Split("."c)

Dim id as string = filebits(1)

'assumes you have filepath in a string
Dim fileLines() as String = File.ReadAllLines(filepath)

Dim linebits() as String = fileLines(0).Split("$"c)

Dim fileDate = Date.ParseExact(linebits(1), "yyyymmdd", CultureInfo.CurrentCulture)

linebits(0) = Nothing


Dim dt as New MyDataSet.TempTable
dt.IDColumn.DefaultValue = id
dt.TheDateColumn.DefaultValue = fileDate

ForEach line as String in fileLines

  If line = nothing Then Continue

  Dim ro as MyDataSet.TempRow = dt.NewTempRow()

  ro.Data1Whatever = 'whatever bit of the line
  ro.Data2Whatever = 'whatever part of the line

Next


'upload to the DB
Dim myTA as New MyDataSetTableAdapters.TempTableAdapter
myTA.Update(dt)
If I used anything in tehre you didnt understand or never saw, then you need to read the tutorial in my signature under the DW2 link.. Read the section "Creating a Simple Data App"
__________________
DW1 DW2 DW3 DW4 DNU PQ
Reply With Quote