M
Maurice Mertens
Hi,
I'm using the code underneath in a function:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim ds As New DataSet
Dim dv As New DataView
Dim strMsg As String, strComputerName As String
Dim row As DataRow
Dim lngCurrentMachineTeller As Long, lngI As Long
cn.ConnectionString = oleDBConn1.ConnectionString
cn.Open()
rs = cn.OpenSchema(ADODB.SchemaEnum.adSchemaProviderSpecific, ,
"{947bb102-5d43-11d1-bdbf-00c04fb92675}")
daAdapter.Fill(ds, rs, "USERS")
ds.Tables("USERS").Columns(0).ColumnName = "Computernaam"
ds.Tables("USERS").Columns(1).ColumnName = "Loginnaam"
ds.Tables("USERS").Columns(2).ColumnName = "Connected"
ds.Tables("USERS").Columns(3).ColumnName = "State"
dv.Table = ds.Tables("USERS")
dv.RowStateFilter = DataViewRowState.CurrentRows
For lngI = 0 To dv.Count - 1
row = dv.Item(lngI).Row
If row.Item("Computernaam").ToString = gsComputerName.ToString Then
msgbox("Same!")
Else
msgbox("Not the same!")
Endif
Next
The problem is strange behaviour in the line "If row.Item
("Computernaam").ToString = gsComputerName.ToString Then
". When in the command window I type: '?row.Item("Computernaam").ToString
= gsComputerName.ToString' it returns true. But when I debug the code
step by step it doesn't go into the if statement. Like it is 'not true'
suddenly. The variable 'gsComputerName' is a global string. They both
contain the same value but the IF STATEMENT "doesn;t work" for some
reason.
--
Met vriendelijke groet / With regards / Saludos,
Moviat Automatisering
Maurice Mertens
mauricem@moviat_KillSpamWordForEMail.nl
tel: +31 162 470 534
fax: +31 162 470 502
I'm using the code underneath in a function:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim ds As New DataSet
Dim dv As New DataView
Dim strMsg As String, strComputerName As String
Dim row As DataRow
Dim lngCurrentMachineTeller As Long, lngI As Long
cn.ConnectionString = oleDBConn1.ConnectionString
cn.Open()
rs = cn.OpenSchema(ADODB.SchemaEnum.adSchemaProviderSpecific, ,
"{947bb102-5d43-11d1-bdbf-00c04fb92675}")
daAdapter.Fill(ds, rs, "USERS")
ds.Tables("USERS").Columns(0).ColumnName = "Computernaam"
ds.Tables("USERS").Columns(1).ColumnName = "Loginnaam"
ds.Tables("USERS").Columns(2).ColumnName = "Connected"
ds.Tables("USERS").Columns(3).ColumnName = "State"
dv.Table = ds.Tables("USERS")
dv.RowStateFilter = DataViewRowState.CurrentRows
For lngI = 0 To dv.Count - 1
row = dv.Item(lngI).Row
If row.Item("Computernaam").ToString = gsComputerName.ToString Then
msgbox("Same!")
Else
msgbox("Not the same!")
Endif
Next
The problem is strange behaviour in the line "If row.Item
("Computernaam").ToString = gsComputerName.ToString Then
". When in the command window I type: '?row.Item("Computernaam").ToString
= gsComputerName.ToString' it returns true. But when I debug the code
step by step it doesn't go into the if statement. Like it is 'not true'
suddenly. The variable 'gsComputerName' is a global string. They both
contain the same value but the IF STATEMENT "doesn;t work" for some
reason.
--
Met vriendelijke groet / With regards / Saludos,
Moviat Automatisering
Maurice Mertens
mauricem@moviat_KillSpamWordForEMail.nl
tel: +31 162 470 534
fax: +31 162 470 502