473,654 Members | 3,098 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Strange Access DB Updat Behavior :-(

Somebody please explain this to me:

I've got an Access database with a table containing some 20 fields. A few
are boolean and integer, but most of them are string(50). And then I've got
one field that is a PM (Memo) field. That one is supposed to contain image
data in string format and the length of my "testimage" string was around
5600 characters.

To update the table I had an OleDbCommand:

myCommand.Comma ndText="UPDATE tblFoo SET Field1=@Data1, Field2=@Data2 ...
etc... Field19=@Data19 , ImageField=@Ima geData WHERE RowID=12" (e.g.)

myCommand.Param eters.AddWithVa lue("@Data1", "teststring 1 teststring1
teststring1 teststring1")
myCommand.Param eters.AddWithVa lue("@Data2", "teststring 2 teststring2
teststring2 teststring2")
..
..
..
myCommand.Param eters.AddWithVa lue("@Data19", "teststring 19 teststring19
teststring19 teststring19")
myCommand.Param eters.AddWithVa lue("@ImageData ", "This is my 5600 character
long string containing image data")

myCommand.Execu teNonQuery

This should work. I've tested it by JUST updating the image string, and
there's no problem. But when I add all the other parameters, suddenly the
ImageData field doesn't contain "This is my 5600 character long string
containing image data" but "0" or "1".

I don't get any error message, just a weird behavior. If I split it up into:

myCommand.Comma ndText="UPDATE tblFoo SET Field1=@Data1, Field2=@Data2 ...
etc... Field19=@Data19 WHERE RowID=12"

myCommand.Param eters.AddWithVa lue("@Data1", "teststring 1 teststring1
teststring1 teststring1")
myCommand.Param eters.AddWithVa lue("@Data2", "teststring 2 teststring2
teststring2 teststring2")
..
..
..
myCommand.Param eters.AddWithVa lue("@Data19", "teststring 19 teststring19
teststring19 teststring19")

myCommand.Execu teNonQuery

myCommand.Param eters.Clear

myCommand.Comma ndText="UPDATE tblFoo SET ImageField=@Ima geData WHERE
RowID=12"

myCommand.Param eters.AddWithVa lue("@ImageData ", "This is my 5600 character
long string containing image data")

myCommand.Execu teNonQuery

THEN everything works! Can anybody explain this to me? No error message...

Is there a maximum size for the OleDbCommand Param collection and if there
is, why don't I get an error message?

I've wasted two days on this now, and would really like to know why.

Bewildered,
Johnny
Dec 7 '07 #1
1 979
Johnny,
Be aware that parameters in OleDB have names, however those do nothing,
therefore you see often an ? in meant for OleDB SQL scripts.

You have to add the parameters in the same sequence as they appear in the
SQL script.

Cor

Dec 8 '07 #2

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

Similar topics

5
4508
by: Bill Grigg | last post by:
I am attempting to set the UnicodeCompression property via code. The following line "appears" to work: tdf.Fields("State").Properties("UnicodeCompression").Value = True I can see the boolean in the property sheet change from No to Yes. However, the behavior has not changed at all. It still behaves as though it were set to No. When I change the boolean in the property sheet GUI it behaves as expected. Any thoughts?
3
3477
by: Dalan | last post by:
At first I was not certain what could cause Access 97 from displaying most jpeg images, but not all. After further testing, it seemed that all original images of less than 275 pixels per inch or less would display, but those close to 300 pixels/inch or greater would not (MS Access cannot recognize the file format xxx.jpg). The larger, original images were scanned and saved as .bmp (at 300 dpi producing a 15MB file). Then the images were...
0
1761
by: William Wisnieski | last post by:
Hello Everyone: I'm having a very strange problem occurring with my Access 2000 database. I call it the "mystery record." Here's the story: I have a query by form that returns a record set in a datasheet. The user double clicks on a row in that datasheet and a main form (pop up) opens bound to a table with a continuous subform bound to a query.
0
1452
by: L Scott | last post by:
Have developed a c# / asp.net web app. Works locally. But over the internet when I access the site, it eventually returns a 'The page cannot be displayed' page. Not always on the same page. Can *eventually* re-display this error page correctly. Have not see this when I access the site locally (from desktop). Many of the pages have sort-able data grids. Have also noticed that I often am getting this 'The page cannot be displayed'...
2
1767
by: Jim Bancroft | last post by:
Hi everyone, I have a DropDownList I populate as outlined below. This is from my code-behind file: private void Page_Load(object sender, System.EventArgs e) { BindMyData(); DataBind(); }
2
8176
by: Nir.Hazan | last post by:
When I try to update my GridView I get the error: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'Update' that has parameters: CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry, original_OrderID. Details: VS2005 C# website. GridView is bound to a ObjectDataSource1.
8
3205
by: FBM | last post by:
Hi there, I am puzzled with the behavior of my code.. I am working on a networking stuff, and debugging with eclipse (GNU gdb 6.6-debian).. The problem I am experiencing is the following: Whenever I declare the sockaddr_in structure inside the main, the debugger crashes at line X*, not being able to access argv parameters (see code below). It is very strange.. by only being there, sockaddr_in does not allow me to question argc...
0
1964
by: asad56 | last post by:
I am workin with a superstore managment project. I connect Access database with main form . Then it work properly. But now I connect same database with another table or field in another form which is child of main form not working. Main form stil working but when try to open child a message show as Please select a valid SQL statement as "Select", "Delet" or "Updat" I am working with Access . I connect database in...
160
5826
by: DiAvOl | last post by:
Hello everyone, Please take a look at the following code: #include <stdio.h> typedef struct person { char name; int age; } Person;
0
8290
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8815
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
8707
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8482
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8593
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...
1
6161
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
4149
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
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1916
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.