I
id10t error
Hello,
I am working on a project where I read in data from a flat file using
a dataset .The program than lets the user scan the barcode. The
problem is when the person scans a barcode on another form and the bar
code is not in the dataset I want to add the new barcode to the
dataset. Here is the code I for the orgianal dataset. Can anyone help
me with this?
Private Sub Load_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim str As String
Dim oRead As System.IO.StreamReader
Dim row As Integer = 0
oRead = File.OpenText("C:\GUNINV\GUNINV.txt")
dt = New DataTable("Gun Inventory")
dt.Columns.Add("gistor", GetType(String))
dt.Columns.Add("gidate400", GetType(String))
dt.Columns.Add("gipage", GetType(String))
dt.Columns.Add("giline", GetType(String))
dt.Columns.Add("gicntl", GetType(String))
dt.Columns.Add("giserl", GetType(String))
dt.Columns.Add("gisku", GetType(String))
dt.Columns.Add("gidesc", GetType(String))
dt.Columns.Add("givend", GetType(String))
dt.Columns.Add("gimanf", GetType(String))
dt.Columns.Add("giloc", GetType(String))
dt.Columns.Add("gidate", GetType(String))
dt.Columns.Add("gitime", GetType(String))
dt.Columns.Add("giuser", GetType(String))
dt.Columns.Add("gistat", GetType(String))
While oRead.Peek <> -1
str = oRead.ReadLine()
dr = dt.NewRow()
dr!gistor = str.Substring(0, 3)
dr!gidate400 = str.Substring(3, 6)
dr!gipage = str.Substring(9, 5)
dr!giline = str.Substring(14, 2)
dr!gicntl = str.Substring(16, 10)
dr!giserl = str.Substring(26, 15)
dr!gisku = str.Substring(41, 10)
dr!Gidesc = str.Substring(51, 25)
dr!Givend = str.Substring(76, 25)
dr!Gimanf = Mid(str, 102, 25)
dr!giloc = ""
dr!gidate = ""
dr!gitime = ""
dr!giuser = ""
dr!gistat = "M"
dt.Rows.Add(dr)
End While
ds.Tables.Add(dt)
I am working on a project where I read in data from a flat file using
a dataset .The program than lets the user scan the barcode. The
problem is when the person scans a barcode on another form and the bar
code is not in the dataset I want to add the new barcode to the
dataset. Here is the code I for the orgianal dataset. Can anyone help
me with this?
Private Sub Load_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim str As String
Dim oRead As System.IO.StreamReader
Dim row As Integer = 0
oRead = File.OpenText("C:\GUNINV\GUNINV.txt")
dt = New DataTable("Gun Inventory")
dt.Columns.Add("gistor", GetType(String))
dt.Columns.Add("gidate400", GetType(String))
dt.Columns.Add("gipage", GetType(String))
dt.Columns.Add("giline", GetType(String))
dt.Columns.Add("gicntl", GetType(String))
dt.Columns.Add("giserl", GetType(String))
dt.Columns.Add("gisku", GetType(String))
dt.Columns.Add("gidesc", GetType(String))
dt.Columns.Add("givend", GetType(String))
dt.Columns.Add("gimanf", GetType(String))
dt.Columns.Add("giloc", GetType(String))
dt.Columns.Add("gidate", GetType(String))
dt.Columns.Add("gitime", GetType(String))
dt.Columns.Add("giuser", GetType(String))
dt.Columns.Add("gistat", GetType(String))
While oRead.Peek <> -1
str = oRead.ReadLine()
dr = dt.NewRow()
dr!gistor = str.Substring(0, 3)
dr!gidate400 = str.Substring(3, 6)
dr!gipage = str.Substring(9, 5)
dr!giline = str.Substring(14, 2)
dr!gicntl = str.Substring(16, 10)
dr!giserl = str.Substring(26, 15)
dr!gisku = str.Substring(41, 10)
dr!Gidesc = str.Substring(51, 25)
dr!Givend = str.Substring(76, 25)
dr!Gimanf = Mid(str, 102, 25)
dr!giloc = ""
dr!gidate = ""
dr!gitime = ""
dr!giuser = ""
dr!gistat = "M"
dt.Rows.Add(dr)
End While
ds.Tables.Add(dt)