update in SQL

  • Thread starter Thread starter flemming eriksen
  • Start date Start date
F

flemming eriksen

Comming from ADO using SQL, I thought it would be simple to select a record
and thereafter updating it.
But the examples I have seen so far in C# looks no good to me.

Has anybody seen a nice, clear example somewhere?


flemming
 
Assuming you have cn and da declared at the module level...
cn = New
SqlConnection(ConfigurationSettings.AppSettings.Item("connectString").ToStri
ng)

da2 = New SqlDataAdapter("Select * From tbl_TitleDescriptions", cn)

Dim sqlCmdBuilder As SqlClient.SqlCommandBuilder

sqlCmdBuilder = New SqlClient.SqlCommandBuilder(da2)

Try

da2.Fill(ds, "Titles")

Catch ex As Exception

MessageBox.Show(ex.ToString)



All you need to do thereafter is fire the update command whever you want to
senda n update.



Cheers,



Bill
 
Back
Top