Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET Database and Reporting > UPDATE command


Reply
 
Thread Tools Display Modes
  #1  
Old 06-12-2006, 11:24 AM
dobbs dobbs is offline
Junior Contributor
 
Join Date: Apr 2003
Posts: 220
Default UPDATE command


I am using the following code to update my Access database, but it is not updating the values. I do not get any errors and it steps through the code fine. Can anyone see a syntax error that I might have?

Code:
        Dim connDriver As String = "Provider=Microsoft.Jet.OLEDB.4.0;"
        Dim connFile As String = "Data Source=" & sPGDBPath & ";"
        Dim sSQL As String
        Dim i As Integer

        dataTable = New Data.OleDb.OleDbConnection(connDriver & connFile)
        dataTable.Open()

        For i = 0 To lstSelected.Items.Count - 1

            sSQL = "UPDATE subinfo SET rules = '" & ruleStr & "'"

            dataCmd = New Data.OleDb.OleDbCommand(sSQL, dataTable)
            dataCmd.ExecuteNonQuery()

        Next

        dataTable.Close()
Thanks!
Reply With Quote
  #2  
Old 06-12-2006, 01:41 PM
PrOpHeT's Avatar
PrOpHeT PrOpHeT is offline
Hopelessly confused...

* Expert *
 
Join Date: Mar 2001
Location: Tyler, Tx.
Posts: 3,054
Default

Only that without a where clause on the update, you would be setting every field in subinfo.rules to rulestr lstSelected.Items.Count - 1 times. I do not see where the lstSelected loop is even relevant to the query?
__________________
When you earnestly believe you can compensate for a lack of skill by doubling your efforts, there's no end to what you can't do ;)

For the love of Gold...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->