.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 9th, 2004, 02:38 PM
stefke stefke is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 1 stefke User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Changing a Database Fields value in VB.Net

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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > Changing a Database Fields value in VB.Net


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT