Solved

Syntax Error on ADO.NET Update

Posted on 2006-06-18
3
275 Views
Last Modified: 2008-03-10
Using VB.NET 2005, first attempt at updating a table using ADO.NET.  Here's the stripped down code:

        Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\LinkCheck\db.mdb"
        Dim sql As String
        Dim adapter As OleDbDataAdapter
        Dim cmdBuilder As OleDbCommandBuilder
        Dim dsLinks As New DataSet
        Dim rowcount As Integer

        sql = "SELECT * FROM [Link] WHERE [IncludeInSearch] = True"
        adapter = New OleDbDataAdapter(sql, connectionString)
        cmdBuilder = New OleDbCommandBuilder(adapter)
        adapter.Fill(dsLinks, "Link")

        With dsLinks.Tables("Link")
            For rowcount = 0 To .Rows.Count - 1
                .Rows(rowcount).Item("IsIndexed") = "yes"
                adapter.Update(dsLinks, "Link")
            Next
        End With

The Update fails with:-
"Syntax error (missing operator) in query expression '((ID = ?) AND ((? = 1 AND LinkingPage IS NULL) OR (LinkingPage = ?)) AND ((? = 1 AND TargetDomain IS NULL) OR (TargetDomain = ?)) AND ((? = 1 AND IsIndexed IS NULL) OR (IsIndexed = ?)) AND ((? = 1 AND IsCached IS NULL) OR (IsCached = ?)) AND ((? = 1 AND I'."


Any thoughts?
0
Comment
Question by:johnalphaone
3 Comments
 

Accepted Solution

by:
johnalphaone earned 0 total points
ID: 16929110
Don't worry, solved it myself.

Added:
        cmdBuilder.QuotePrefix = "["
        cmdBuilder.QuoteSuffix = "]"

0
 
LVL 2

Expert Comment

by:Bill_PSC
ID: 16936260
I think you may have to add your select params on your dataadapter before the fill dataset command.

ie:

adapter.SelectCommand.Parameters("yourValue").Value =yourValue
adapter.fill(dataset,table)
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now