Solved

Syntax Error on ADO.NET Update

Posted on 2006-06-18
3
280 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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