473,748 Members | 2,398 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add DataColumn to DataSet

Hi I succeded to add a DataColumn to DataSet but now I've one big problem.
The value of this column would be a personal function result, I try a lot of
time but the result is always empty.
Why?
There's a method to do this thing?

This is the code
cols = ImageDataSet.Ta bles("Immagini" ).Columns
myCol = cols.Add()
With myCol
.DataType = System.Type.Get Type("System.St ring")
.ColumnName = "IPTC"
.Expression = ReadIPTCPropert y("Path")
.ReadOnly = True
.Unique = False
End With

And this is the function:

Private Function ReadIPTCPropert y(ByVal Path As String) As String
Dim gr As New Graphic
gr.ReadIPTC = True
gr.SetFile(Path )
Dim ip As Graphic.IPTCIte m
For Each ip In gr.IPTC
If UCase(ip.Name) = "CAPTION" Then
ReadIPTCPropert y = "'" & ip.Text & "'"
End If
Next
End Function

Thank you.
--
Filippo Macchi
www.filippomacchi.it
Nov 18 '05 #1
1 1598
You cannot set a 'column' to a value. You can set a column within a row to a
value:

e.g. ImageDataSet.Ta bles("Immagini" ).Rows(0).Item( myCol.ColumnNam e) = ...

or you can set the default value of a column:

e.g. myCol.DefaultVa lue = ...

The structure of a dataset can be a little confusing:

Dataset - contains Tables
Tables - contains Columns and Rows
Columns - can have expressions (to filter / calculate, create aggregate cols)
Rows - Contains Items (refering to the columns!)

So it is the Item property you should be trying to access.
Also try using the 'return' statement in your personal function - just to
make sure you are actually returning data from it:

.....
Dim strRet as String
For Each ip In gr.IPTC
If UCase(ip.Name) = "CAPTION" Then
strRet = "'" & ip.Text & "'"
End If
Next
Return strRet
......

Mark

"Azkaban" wrote:
Hi I succeded to add a DataColumn to DataSet but now I've one big problem.
The value of this column would be a personal function result, I try a lot of
time but the result is always empty.
Why?
There's a method to do this thing?

This is the code
cols = ImageDataSet.Ta bles("Immagini" ).Columns
myCol = cols.Add()
With myCol
.DataType = System.Type.Get Type("System.St ring")
.ColumnName = "IPTC"
.Expression = ReadIPTCPropert y("Path")
.ReadOnly = True
.Unique = False
End With

And this is the function:

Private Function ReadIPTCPropert y(ByVal Path As String) As String
Dim gr As New Graphic
gr.ReadIPTC = True
gr.SetFile(Path )
Dim ip As Graphic.IPTCIte m
For Each ip In gr.IPTC
If UCase(ip.Name) = "CAPTION" Then
ReadIPTCPropert y = "'" & ip.Text & "'"
End If
Next
End Function

Thank you.
--
Filippo Macchi
www.filippomacchi.it

Nov 18 '05 #2

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

Similar topics

8
4451
by: Christian Dokman | last post by:
Hello, I'd like to fill a dataset column with a product-description. Sometimes the size of the description-text is longer than 255 characters. At that length, the dataset automatically cuts off the text. Does anyone know how I can use more than 255 characters in a dataset column? Greetings, Christian.
0
1688
by: SoYouKnowBrig | last post by:
Hi All, I am using Microsoft.ApplicationBlocks.Cache.CacheManager to persist a System.Data.Dataset object. This Dataset object has a DataTable that is created from an existing DataTable using the Clone() method. Before I add the new DataTable to the DataSet, I change the DataType of a DataColumn from System.String to System.Int64. I then add data to the new table and then add it to the DataSet. Then DataSet is then added to the Cache....
1
5403
by: Chris | last post by:
I'm having trouble Serializing a System.Data.DataColumn object. When I try to serialize it, I get the following: System.NotSupportedException: Cannot serialize member System.ComponentModel.MarshalByValueComponent.Site of type System.ComponentModel.ISite because it is an interface. I tried a number of workarounds without sucess:
4
4437
by: ALI-R | last post by:
Is it a possibel to assign an array to a DataColumn then bind it to a Combo box?? Is the follwoing code right? public static DataSet InsertParamsToDS(ReportParameter arrParams) { DataSet RepDS=new DataSet(); DataTable objDataTable=new DataTable("ReportParams");
5
1431
by: Larry Bird | last post by:
I've created a AlertDataClass below within the class I have tables and column that I've create. In the AlertDataAccess class I'm trying to insert data into my tables. AlertDataAccess is a Module that is trying to insert data into the tables. Within the AlertDataClass is subroutine that init and creates ColumnNames. In invoke the AddDataColumnNames() sub to create the column headers. Why can't I see the column names in my module that I'm...
4
2456
by: bordsby | last post by:
Situation: I am using an OleDbDataAdapter to fill a DataSet's DataTable with data from an Access database. The DataSet's DataTable is bound to a DataGrid. After the OleDbDataAdapter.Fill method is called, the DataGrid displays the column headings as the column names output from the Access SQL query. I would like to change some of the styles for certain columns in the DataGrid, so I first need to set the DataGridColumnStyle.MappingName...
1
7847
by: mfunkmann | last post by:
Hi, I recently got an error and I don't know how to fix it: Error 1 'System.Data.DataColumn' does not contain a definition for 'Windows' C:\c#\CsharpPRO\Form1.Designer.cs 304 77 CsharpPRO I am note sure what to do because all propertiers work, except the System.Data.DataColumn.. I didn't write any code by hand and used the visual studio to set the properties..
0
942
by: SWIL | last post by:
Hi, I made my own datacolumn Class which inherits from Data.DataColumn. To this class I have added 2 properties. To add datacolumn created through my new class I have to call.. DataSet.Table.Column.Add method which is a part of datacolumncollection , where the defined data column type is Data.DataColumn and not my custom column. Thus I have no method to access my datacolumn properties through dataset.
1
1654
by: Sagaert Johan | last post by:
Hi When i add a datacolumn to a dataset and then call Update on the dataset then my MS Access datbase does not reflect the changes.(no coumn was added to the table) DataColumn newcolumn = new DataColumn("NewlyAdded", System.Type.GetType("System.Int32"));
0
8991
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
8830
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
9544
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
9372
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
9324
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,...
1
6796
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
6074
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
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2783
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.