I am using VB.NET 2003, SQL 2000, and SqlDataAdapter.
For every record in tblA where colB = 'abc', I want to update the value in
colA.
In VB6, using ADO I can loop thru the recordset,set the values of colA and
call the Update method.
How can I do this in VB.NET and SqlDataAdapter ? Thank you.
m_cmdSQL = New SqlClient.SqlCo mmand
With m_cmdSQL
.Connection = adoCon
.CommandText = sSQL
End With
m_daSQL = New SqlClient.SqlDa taAdapter
m_dsSQL = New DataSet
m_daSQL.SelectC ommand = "select * from tblA where [colB] = 'abc'"
m_daSQL.Fill(m_ dsSQL)
lRow = 0
For Each aRow In m_dsSQL.Tables( 0).Rows()
m_dsSQL.Tables( 0).Rows(lRow).I tem("colA") = lrow --this
updates the value in memory, but not in the database
lRow = lRow + 1
Next
For every record in tblA where colB = 'abc', I want to update the value in
colA.
In VB6, using ADO I can loop thru the recordset,set the values of colA and
call the Update method.
How can I do this in VB.NET and SqlDataAdapter ? Thank you.
m_cmdSQL = New SqlClient.SqlCo mmand
With m_cmdSQL
.Connection = adoCon
.CommandText = sSQL
End With
m_daSQL = New SqlClient.SqlDa taAdapter
m_dsSQL = New DataSet
m_daSQL.SelectC ommand = "select * from tblA where [colB] = 'abc'"
m_daSQL.Fill(m_ dsSQL)
lRow = 0
For Each aRow In m_dsSQL.Tables( 0).Rows()
m_dsSQL.Tables( 0).Rows(lRow).I tem("colA") = lrow --this
updates the value in memory, but not in the database
lRow = lRow + 1
Next
Comment