dts and vb.net




I have a vb.net application with a browser. The user has to select a
..dat file and when he clicks the send button that file is sent to the
db and the data in the file is split and put into the correct fields
in the db table.

I have never used dts before and don't know what are the steps
involved. If someone can please guide me i will appreicate it.
I don't even know what the first step is.




Bernie Yaeger

Hi Avital,

DTS - at least in SQL Server - is available as one of the main options when
you open the local database node. Open it, and you select 'local packages'
right click and select 'new package' and follow the wizard along from there.

However, I would not approach it in that fashion. I usually take a .dat
file and open it with a streamreader, and then count characters and
distribute accordingly. Here's some choppy code that will give you the
basic idea:

Dim tstream As TextStream
tstream = fsys.OpenTextFile("h:\tavo\babetc\" & datsbox.Text,

bufferbase = tstream.ReadLine ' get rid of first line

Dim endseeker As Integer = 30 ' ie, the last short line

Dim mstnum, msaledate_c, mfile_name_, mupc, mbipad, missuecode, mrawissue As

Dim mdatestring, mplusminus As String

Dim newdatevar, msaledate, priorthreshold As Date

Dim m_cprice As Decimal

Dim mqty, mmissuecode, mprefixnum As Integer

Dim mfailed, mprefix, tempgstransbipad, tissue_is, priorthresholdstring As

Dim earliestissue, currentissue As String

Dim ifind As Integer

Dim irow, irow2, prow, prow2 As DataRow

Dim irows, irows2, prows, prows2 As DataRow()

Dim mrow As DataRow

Dim vue_g As New DataView(dsgstrans.Tables(0))

Do While tstream.AtEndOfStream = False

bufferbase = tstream.ReadLine

If bufferbase.Length < endseeker Then

Exit Do

End If

buffer1 = Trim(Mid(bufferbase, 1, 4))

mstnum = "00" & buffer1

mdatestring = Mid(bufferbase, 11, 5)

msaledate_c = Mid(bufferbase, 11, 2) & "/" & Mid(bufferbase, 13, 2) & "/" &
"20" & Mid(bufferbase, 15, 2)

msaledate = CDate(msaledate_c)

mfile_name_ = datsbox.Text

mupc = Mid(bufferbase, 17, 13)

mbipad = Mid(bufferbase, 25, 5)

mqty = CInt(Mid(bufferbase, 65, 5))

mplusminus = Mid(bufferbase, 70, 1)


da.Update(ds, "DS")

Catch ex As Exception


End Try





Bernie Yaeger

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads