F
fniles
I use Dataset and to select certain records in the Dataset I use the SELECT
method (m_dsSQL.Tables(0).Select("colB > 0") ).
I am looping until colB <= 0.
The problem is, after I fill the dataset and do SELECT, if inside the LOOP I
change the value of ColB, it is not being reflected in the Dataset SELECT.
Is there a way in the LOOP to reflect the changes that has been made in colB
?
For ex:
Dim m_daSQL As SqlClient.SqlDataAdapter
Dim m_cmdSQL As SqlClient.SqlCommand
Dim m_dsSQL As DataSet
Dim aRowHistTrades As DataRow()
dim bContinue as boolean
dim sSQL as string
sSQL = "select * from myTable where ColA = 'ABC'"
m_cmdSQL = New SqlClient.SqlCommand
With m_cmdSQL
.Connection = adoCon
.CommandText = sSQL
End With
m_daSQL = New SqlClient.SqlDataAdapter
m_dsSQL = New DataSet
m_daSQL.SelectCommand = m_cmdSQL
m_daSQL.Fill(m_dsSQL)
bContinue = True
'--->Here i want to loop thru myTable until colB is <= 0
Do While bContinue
'--->after the 1st iteration, colB value is changed, but the code below
does not reflect that.
'--->For ex: ColB starts with value = 2.5, after 1st iteration, in the
database colB = 1.5
'--->but the following code does not reflect that, colB stays at 2.5,
thus aRowHistTrades.Length is always > 0
aRowHistTrades = m_dsSQL.Tables(0).Select("colB > 0")
If aRowHistTrades.Length > 0 Then
: --> If ColB is still > 0 then, do some codes that changes/reduces the
value of ColB
colB = aRowHistTrades(0).Item("colB") '--> after 1st iteration,
this value is still the same with before 1st iteration
Else
bContinue = False
End If
Loop
Thank you.
method (m_dsSQL.Tables(0).Select("colB > 0") ).
I am looping until colB <= 0.
The problem is, after I fill the dataset and do SELECT, if inside the LOOP I
change the value of ColB, it is not being reflected in the Dataset SELECT.
Is there a way in the LOOP to reflect the changes that has been made in colB
?
For ex:
Dim m_daSQL As SqlClient.SqlDataAdapter
Dim m_cmdSQL As SqlClient.SqlCommand
Dim m_dsSQL As DataSet
Dim aRowHistTrades As DataRow()
dim bContinue as boolean
dim sSQL as string
sSQL = "select * from myTable where ColA = 'ABC'"
m_cmdSQL = New SqlClient.SqlCommand
With m_cmdSQL
.Connection = adoCon
.CommandText = sSQL
End With
m_daSQL = New SqlClient.SqlDataAdapter
m_dsSQL = New DataSet
m_daSQL.SelectCommand = m_cmdSQL
m_daSQL.Fill(m_dsSQL)
bContinue = True
'--->Here i want to loop thru myTable until colB is <= 0
Do While bContinue
'--->after the 1st iteration, colB value is changed, but the code below
does not reflect that.
'--->For ex: ColB starts with value = 2.5, after 1st iteration, in the
database colB = 1.5
'--->but the following code does not reflect that, colB stays at 2.5,
thus aRowHistTrades.Length is always > 0
aRowHistTrades = m_dsSQL.Tables(0).Select("colB > 0")
If aRowHistTrades.Length > 0 Then
: --> If ColB is still > 0 then, do some codes that changes/reduces the
value of ColB
colB = aRowHistTrades(0).Item("colB") '--> after 1st iteration,
this value is still the same with before 1st iteration
Else
bContinue = False
End If
Loop
Thank you.