Solved

Syntax Error on ADO.NET Update

Posted on 2006-06-18
3
281 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

636 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