Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8973195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:23:29+00:00 2026-06-15T18:23:29+00:00

In .NET 4.5 I am trying to execute an OleDBCommand on an access database.

  • 0

In .NET 4.5 I am trying to execute an OleDBCommand on an access database.

The code I have is

Dim rows As Integer
Dim dbCommand As OleDb.OleDbCommand = New OleDb.OleDbCommand
Dim dbTransaction As OleDb.OleDbTransaction

Call gOleCn.Open()
dbTransaction = gOleCn.BeginTransaction
dbCommand = New OleDb.OleDbCommand("", gOleCn, dbTransaction)
dbCommand.CommandText = "UPDATE Tレイヤ管理 SET レイヤー=0 WHERE 名前 LIKE '水田_*';"
rows = dbCommand.ExecuteNonQuery()

The query executes fine in access itself, but in .NET it never affects any rows.
It works if I change the CommandText to "UPDATE Tレイヤ管理 SET レイヤー=0 WHERE 名前='水田_" & Parameter & "'" and specify the name exactly using Parameter, but then I’d have to write a loop, whilst with LIKE it’s all done in one line.

But how can this be made to work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:23:30+00:00Added an answer on June 15, 2026 at 6:23 pm

    See the accepted answer to this SO question: Microsoft Jet wildcards: asterisk or percentage sign?

    Since you’re using OleDb, you are using ANSI-92 query mode, so must use % instead of * as the wild card character. The reason your UPDATE worked within an Access session is that it uses ANSI-89 query mode by default.

    "UPDATE Tレイヤ管理 SET レイヤー=0 WHERE 名前 LIKE '水田_%';"
    

    If you intended the _ (underscore) character to match the literal character (instead of the ANSI-92 wild card for any single character), make it a single-member character class in the pattern:

    "UPDATE Tレイヤ管理 SET レイヤー=0 WHERE 名前 LIKE '水田[_]%';"
    

    I’m not sure what happens with those unicode table and field names. From your question it sounds like they may not be causing problems. However, if nothing else works, I would try enclosing them in square brackets:

    "UPDATE [Tレイヤ管理] SET [レイヤー]=0 WHERE [名前] LIKE '水田[_]%';"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to execute an sql statement in vb.net to an Access database, I
Trying to execute powershell script in my C# code. Using .NET Framework v. 4.0.30319
I have a snippet of code, simply trying to execute a script on a
I am trying to execute this code in C#.NET to turn an SQL table
I am trying to execute the following code in a ASP .Net web page:
I'm using ASP.net and I'm trying to execute a webmethod from jquery. I have
I have installed Visual Studio .NET 2005. But when I am trying to execute
I'm trying to execute a Quartz.net job from a separate assembly. The class inherits
I am trying to execute DBCC CHECK DB('MyDB) using ADO.Net, but how can I
I'm new in asp.net and trying to pull values from Sqlserver into a listView

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.