473,800 Members | 2,731 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OleDB parameterized query for Access Database

bob
Hi,
Its been a long time since I have had the joy of feeding parameterized
query CommandText strings to an OleDBCommand object.
I have tried all manner of versions of " update foo set bar = @bar
where id = @id"
I have wrapped the fields in square brackets and the parameters in
square brackets and all manner of other strange variations.
The ExecuteNonQuery fires but the table doesn't update.

Finally went back to the old standby of ? as parameter place holder
and relying on Parameters ordinal position in the collection.

Is it really still this primitive or am I just screwing up the syntax?

Thanks
Bob
Jun 27 '08 #1
2 2725
On Apr 23, 11:55*pm, bob <startatbob_cl. ..@cutthis.adri ley.co.nz>
wrote:
Hi,
Its been a long time since I have had the joy of feeding parameterized
query CommandText strings to an *OleDBCommand object.
I have tried all manner of versions of *" update foo set bar = @bar
where id = @id"
I have wrapped the fields in square brackets and the parameters in
square brackets and all manner of other strange variations.
The ExecuteNonQuery fires but the table doesn't update.

Finally went back to the old standby of ? as parameter place holder
and relying on Parameters ordinal position in the collection.

Is it really still this primitive or am I just screwing up the syntax?

Thanks
Bob
Hi,

Unfortunatelly it's :(
Jun 27 '08 #2
bob
Hi Ignacio,
Thanks for your reply.
Scott says you can actually use named parameters but yes ordinal
position must be watched. I am going to stick with the question marks
so I don't fall for the same trap again.
regards
Bob

On Thu, 24 Apr 2008 06:55:21 -0700 (PDT), "Ignacio Machin ( .NET/ C#
MVP )" <ig************ @gmail.comwrote :
>On Apr 23, 11:55*pm, bob <startatbob_cl. ..@cutthis.adri ley.co.nz>
wrote:
>Hi,
Its been a long time since I have had the joy of feeding parameterized
query CommandText strings to an *OleDBCommand object.
I have tried all manner of versions of *" update foo set bar = @bar
where id = @id"
I have wrapped the fields in square brackets and the parameters in
square brackets and all manner of other strange variations.
The ExecuteNonQuery fires but the table doesn't update.

Finally went back to the old standby of ? as parameter place holder
and relying on Parameters ordinal position in the collection.

Is it really still this primitive or am I just screwing up the syntax?

Thanks
Bob

Hi,

Unfortunatel ly it's :(
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6078
by: gary b | last post by:
Hello When I use a PreparedStatement (in jdbc) with the following query: SELECT store_groups_id FROM store_groups WHERE store_groups_id IS NOT NULL AND type = ? ORDER BY group_name
14
3433
by: | last post by:
Hi, I was performing SQL UPDATE queries and I notice that they SUCCEED on the ExecuteNonQuery() call with NO exceptions raised BUT they fail at the Database. They say they succeed in the code but they fail at the database. To fix this they Parameters.Add must be called in the ORDER they are in the SQL STATEMENT. This is confusing and bad.
0
5294
by: silesius | last post by:
I've been using VS 2003 to develop a webapplication using C#. Today I exported the application to a remote webserver I begun experiencing problems. It's a simple application that retrieves some information from an Access database. It worked fine when I ran on my computer. I use a parameterized query to retrieve some customer specific information. Customer logs in, I store the username they log in with in the session state and on the...
2
1605
by: VMI | last post by:
In Access, I can create a query like "select * from myTable where Name like '*Joe #*' " and it'll return records like ("Bob Joe 1", "Rick Joe 122", etc...). What's the equivalent to that in a query that's being run using OleDB? Thanks.
11
3806
by: anony | last post by:
Hello, I can't figure out why my parameterized query from an ASP.NET page is dropping "special" characters such as accented quotes & apostrophes, the registered trademark symbol, etc. These symbols insert without problem from query analyzer, so that suggests it's something within ASP.NET. I've tried using .NET textbox web controls as well as html textareas. I have a test database set up with 4 fields: varchar, nvarchar, text, and...
0
2784
by: silesius | last post by:
I've been using VS.NET 2003 to develop a webapplication using C#. Today I exported the application to another webserver I begun experiencing problems. It's a simple application that retrieves some information from an Access database. It worked fine when I ran on my home computer. I use a datagrid witha a dataset and a parameterized query to retrieve some customer specific information. Customer logs in, I store the username they log in...
3
8841
by: Brian Foree | last post by:
I am developing an ASP.NET application that uses Access 2000 as its backend, and have just started getting the following error on 2 ASP.NET pages that had been working until late last week (and I don't think I made any changes to either page other than changing the user control that creates the header). Server Error in '/myApp' Application. ---------------------------------------------------------------------------- ----
2
2867
by: Martin | last post by:
Hi, I currently have an application that connects to an MS ACCESS database. This application uses an OLEDB connection string for MS ACCESS. Now, I'd like to upsize the application so I converted the db to SQL SERVER and this went well. Next thing I changed the connection string from OLEDB for MS ACCESS to OLEDB for SQL SERVER. I expected this to work resonably well, however I found that it never worked
8
8054
by: Roland Hall | last post by:
In Access you use "*" + + "*", + can be replaced with & Calling a parameterized query in Access requires % be used in place of *, however, all that I have read show dynamic SQL passed to Access: WHERE LIKE '" & ASPvar & "' % ORDER BY ... However, my call is similar to: conn.qMyLookup strVar, rs
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10504
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.