R
ruca
I have this code to read a text file (.txt) and fill a dataset and then
filter, using DataView, by user. The final result I want to put into a
datagrig, but this last part is not happen and I don't know why.
the code is below
------------------------------------------------------------------------
LerLinha = New StreamReader(LerPath)
dsMrc = New DataSet
dtMrc = New DataTable("Mrc")
dcMrc = New DataColumn("Cod",
System.Type.GetType("System.String"))
dcMrc = New DataColumn("Data",
System.Type.GetType("System.String"))
dcMrc = New DataColumn("Hora",
System.Type.GetType("System.String"))
dtMrc.Columns.Add("Cod")
dtMrc.Columns.Add("Data")
dtMrc.Columns.Add("Hora")
Do
txtLine = LerLinha.ReadLine()
If Not txtLine Is Nothing Then
Cd = ProcessCod(txtLine)
dtData = ProcessData(txtLine)
dtHora = ProcessHora(txtLine)
drMrc = dtMrc.NewRow()
drMrc("Cod") = Cd
drMrc("Data") = dtData
drMrc("Hora") = dtHora
dtMrc.Rows.Add(drMrc)
End If
'dsMrc.Tables("Mrc").Rows.Add(drMrc)
Loop Until txtLine Is Nothing
dsMrc.Tables.Add(dtMrc)
'dsMrc.Tables("Mrc").Select("Cod='" & FindUser & "'")
Dim strFilter As String
Dim findRows() As DataRow
Dim dtAux As DataTable
Dim v As New DataView
v.Table = dtMrc
v.RowFilter = "Cod=" & FindUser
v.Sort = "Data ASC"
//this is my datagrid
dgMarcacoes.DataSource = v
LerLinha.Close()
LerLinha = Nothing
filter, using DataView, by user. The final result I want to put into a
datagrig, but this last part is not happen and I don't know why.
the code is below
------------------------------------------------------------------------
LerLinha = New StreamReader(LerPath)
dsMrc = New DataSet
dtMrc = New DataTable("Mrc")
dcMrc = New DataColumn("Cod",
System.Type.GetType("System.String"))
dcMrc = New DataColumn("Data",
System.Type.GetType("System.String"))
dcMrc = New DataColumn("Hora",
System.Type.GetType("System.String"))
dtMrc.Columns.Add("Cod")
dtMrc.Columns.Add("Data")
dtMrc.Columns.Add("Hora")
Do
txtLine = LerLinha.ReadLine()
If Not txtLine Is Nothing Then
Cd = ProcessCod(txtLine)
dtData = ProcessData(txtLine)
dtHora = ProcessHora(txtLine)
drMrc = dtMrc.NewRow()
drMrc("Cod") = Cd
drMrc("Data") = dtData
drMrc("Hora") = dtHora
dtMrc.Rows.Add(drMrc)
End If
'dsMrc.Tables("Mrc").Rows.Add(drMrc)
Loop Until txtLine Is Nothing
dsMrc.Tables.Add(dtMrc)
'dsMrc.Tables("Mrc").Select("Cod='" & FindUser & "'")
Dim strFilter As String
Dim findRows() As DataRow
Dim dtAux As DataTable
Dim v As New DataView
v.Table = dtMrc
v.RowFilter = "Cod=" & FindUser
v.Sort = "Data ASC"
//this is my datagrid
dgMarcacoes.DataSource = v
LerLinha.Close()
LerLinha = Nothing