|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I'm trying to create an application in VB.Net which is able to retrieve data from a database, change it and save it back into the database again. In Visual Basic 6.0 I would do it like: Dim oCon As ADODB.Connection Dim sCon As String Dim oRs As ADODB.RecordSet Dim sSql As String sCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MusicDB.mdb;Persist Security Info=False" Set oCon = New ADODB.Connection oCon.ConnectionString = sCon oCon.Open sSql = "SELECT * FROM ARTISTS WHERE artist_id = 375" Set oRs = New ADODB.RecordSet oRs.CursorLocation = adUseClient oRs.Open sSql, oCon, adOpenDynamic, adLockBatchOptimistic Set oRs.ActiveConnection = Nothing If Not (oRs.BOF And oRs.EOF) Then oRs.Fields("artist_name") = "Madonna" Set oRs.ActiveConnection = oCon oRs.Update oRs.UpdateBatch Set oRs.ActiveConnection = Nothing End If Set oRs = Nothing oCon.Close Set oCon = Nothing Can anyone tell me how to do this in VB.Net I've seen many examples using and Update query, but I don't want to do it like that. A little basic sample application or function would be very helpfull Thanx in Advance! Stefke |
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > Changing a Database Fields value in VB.Net |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|