F
fniles
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.SqlCommand
With m_cmdSQL
.Connection = adoCon
.CommandText = sSQL
End With
m_daSQL = New SqlClient.SqlDataAdapter
m_dsSQL = New DataSet
m_daSQL.SelectCommand = "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).Item("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.SqlCommand
With m_cmdSQL
.Connection = adoCon
.CommandText = sSQL
End With
m_daSQL = New SqlClient.SqlDataAdapter
m_dsSQL = New DataSet
m_daSQL.SelectCommand = "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).Item("colA") = lrow --> this
updates the value in memory, but not in the database
lRow = lRow + 1
Next