473,763 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Assigning Array to an OLE object field in access database

3 New Member
Hi all

I am facing a problem in storing an array of integers to an OLE object field in the database, the used code for this action is listed below:

Expand|Select|Wrap|Line Numbers
  1. Sub Import_data()
  2.  
  3.  
  4.  
  5. Dim oAccesss As New ADODB.Connection
  6. Dim oRecordset11 As New ADODB.Recordset
  7. oAccesss.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\DBS.mdb;"
  8. oRecordset11.Open "Select OLEdata From Table1", oAccesss, adOpenKeyset, adLockOptimistic
  9.  
  10. Dim SS(10) As integer
  11.  
  12.  
  13.  
  14. For N = 0 To 9
  15.  
  16. SS(N) = rnd
  17. Next N
  18.  
  19. With oRecordset11
  20. .Fields.Item(0) = SS
  21.  
  22. .update
  23.  
  24. end with
  25.  
  26.  
  27.  
  28. End sub
  29.  

Kindly Advice.
Jul 15 '12 #1
5 4228
zmbd
5,501 Recognized Expert Moderator Expert
You're trying to place an array in a single field in a record source, yes?

What error are you getting...

-z
Jul 15 '12 #2
Doicare
3 New Member
Yes You are right, I am trying to place an array in a single field, the field data type is OLE Object.

The error I get is "Type Mismatch" and the error location at line 20 in the listed above code.
Jul 15 '12 #3
zmbd
5,501 Recognized Expert Moderator Expert
I don't think you can do so in MS Access... I'll do a tad more checking in few reference books.

I guess I don't understand why you would want to store an array in an Access table. Can you explain a little more about what you hope to accomplish by doing so? Without any further information, this leads me to suspect that there may be some further normalization that the database could benifit from ( Database Normalization & Table Structures ) .
Jul 15 '12 #4
Doicare
3 New Member
Do you think it can be done in MS SQL?
Jul 16 '12 #5
zmbd
5,501 Recognized Expert Moderator Expert
There are workarounds to store the data from an array in both MS Access and I believe in MYSQL (you'll need to query in that forum...) However, I do not believe that you will be able to store the array as native even in MYSQL.

There is the multi-value field that is new to MSAccess-(2007/2010). http://office.microsoft.com/en-us/ac...001233722.aspx

Admittedly, I haven't used this field type; however from what I have read, and the examples I've seen, I would avoid these like the plague if I were you. Anything I’ve seen these used for can be readily done using the rules for normalization!

Simply Put, arrays are, IMHO, the for-runner of database tables… so why put a table within a table?

Once again, why are you trying to store an array in a single field of a table? In a RDMS this is normally not considered best practice.

IMHO: If you are trying to store an array, more than likely the data is missing a normalization step.
-z
Jul 16 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1912
by: Sandi | last post by:
I have a simple problem: I have an Access database (images.mdb) that has 2 columns: one is the id of the picture (an integer) and one (column named picture) is a field of type OLE Object which contains an image (it can store jpg, bmp, gif, but I don't know what image is stored inside). I want to retrieve the picture stored in the database and identified by a given id and display it in a web page (.aspx). I write in Visual C#, but it does...
0
1622
by: Sandi | last post by:
I have a simple problem: I have an Access database (images.mdb) that has 2 columns: one is the id of the picture (an integer) and one (column named picture) is a field of type OLE Object which contains an image (it can store jpg, bmp, gif, but I don't know what image is stored inside). I want to retrieve the picture stored in the database and identified by a given id and display it in a web page (.aspx). I write in Visual C#, but it does...
3
4204
by: Sandi | last post by:
I have a simple problem: I have an Access database (images.mdb) that has 2 columns: one is the id if the picture (an integer) and one (column named picture) is a field of type OLE Object which contains an image (it can store jpg, bmp, gif, but I don't know what image is stored inside). I want to retrieve the picture stored in the database and identified by a given id and display it in a web page (.aspx). I write in Visual C#, but it does...
3
4368
by: Sandi | last post by:
I have a simple problem: I have an Access database (images.mdb) that has 2 columns: one is the id if the picture (an integer) and one (column named picture) is a field of type OLE Object which contains an image (it can store jpg, bmp, gif, but I don't know what image is stored inside). I want to retrieve the picture stored in the database and identified by a given id and display it in a web page (.aspx). I write in Visual C#, but it does...
2
1999
by: Cary | last post by:
This may reveal my poor programming skills, but here goes... I'm building a pricing tool for my business. I'm nearing the end of the project, and I've been asked to be able to save quotes in some sort of database (Major Feature Creep). For each quote, I've got two kinds of variables. The first are global for the quote, such as numQuoteRows QuoteFinalCost CustomerID
0
1254
by: babu | last post by:
Can Anybody help me about this issue, that how to retrive ole object(datatype) in MS Access database what variable i have to use to store data in VB.NET .The Format of the ole object stored like this in the database(x,y*x1,y1*x2,y2*............)these are the coordinates i want to retrive from the database. thanks .
8
8934
by: Mark | last post by:
Hello. I am attempting to write binary data from a file to an OLE Object field, and then write the file back out from the database. I am reading and writing the files in binary mode, and using GetChunk and AppendChunk to read and write binary data from the OLE Object field. I am using VBA and DAO for this experiment. The OLE Object field is being used to store Long Binary data.
1
3800
by: Rico | last post by:
Hello, I have an ole object field (Access XP/2002) which I store images in. I have a couple of questions regarding this; is it possible to determine the image dimensions? Secondly, is there any way to determine what application is associated with the stored OLE Object and is there a way to associate that object programmatically with another application? Thanks!
1
1975
by: pagoto123 | last post by:
i want the code to read an object (ole object) from access database to a textbox in asp.net . the object might be picture or notepad (txt) here is my command MsgBox("Result found", MsgBoxStyle.Information, "Results will be shown ") MovieID.Text = myReader(0) MovieTitle.Text = myReader(1) MovieDirector.Text = myReader(2) Actor.Text = myReader(3) summary.Text = myReader(4) ...
3
4668
by: RRsonawane11 | last post by:
Hi, I have store image as OLE object in access database and i wan to display that image using ASP.but problem is that binary format is displaying on page...so can i get that image in asp
0
9563
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
9386
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
10145
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...
1
9938
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
9822
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
8822
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
7366
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
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.