Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update Sql Table Using VB
Message
From
24/12/2002 14:04:11
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Update Sql Table Using VB
Miscellaneous
Thread ID:
00735673
Message ID:
00735673
Views:
40
Hi,

What would be the code to update two fields in a SQL Table using VB.net?

Below is what I would like to do but I know the code is totally incorrect.

Sample Customer table - CustomerId int
CustomerName varchar
Address varchar
City varchar
State varchar

Sample Order table - CustomerId int
OrderID int
Processed bit
Shipped bit
DateShipped datetime

I want to be able to update the SQL Order Table using Sql Commands in VB.

Update field Shipped with 1
field DateShipped with today's date

Created SqlDataAdapter1 Using Query Wizard - Customer Table, Orders Table
Selected Fields CustomerId,CustomerName,Address,City,State,OrderId
Created OrdersToBeProcessedDataset

strUpdateCommand = "UPDATE _______________" ' Need Proper Code Here

Open Connection

Dim myDataRow As DataRow
For Each myDataRow In OrdersToBeProcessedDataset.Tables("Orders").Rows
' initialize fields with values
Processed = 1 ' Need Proper Code Here
DateProcessed = NOW() ' Need Proper Code Here
UpdateCMD.ExecuteNonQuery()
next

Close Connection

Any error code to make sure the updates are processed would also be appreciated.

Is this an acceptable way to Update Sql Tables or is there a better way?

Thanks
Roland
Next
Reply
Map
View

Click here to load this message in the networking platform