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

Home Posts Topics Members FAQ

Default DataColumn.Colu mnName Property?

Situation:
I am using an OleDbDataAdapte r to fill a DataSet's DataTable with data
from an Access database. The DataSet's DataTable is bound to a
DataGrid. After the OleDbDataAdapte r.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
DataGridColumnS tyle.MappingNam e Property of each DataGridColumnS tyle.
According to the .NET docs, "The MappingName property is usually set to
the ColumnName of a DataColumn."

Question:
What is the ColumnName Property of a DataColumn equal to when the
DataColumn is automatically created as a result of the
OleDbDataAdapte r? Is it equal to the column heading string?

Nov 21 '05 #1
4 2456
Hi,

"bordsby" <bo*****@gmail. com> wrote in message
news:11******** ************@o1 3g2000cwo.googl egroups.com...
Situation:
I am using an OleDbDataAdapte r to fill a DataSet's DataTable with data
from an Access database. The DataSet's DataTable is bound to a
DataGrid. After the OleDbDataAdapte r.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
DataGridColumnS tyle.MappingNam e Property of each DataGridColumnS tyle.
According to the .NET docs, "The MappingName property is usually set to
the ColumnName of a DataColumn."

Question:
What is the ColumnName Property of a DataColumn equal to when the
DataColumn is automatically created as a result of the
OleDbDataAdapte r? Is it equal to the column heading string?


ColumnName is the name of the column as it appears in the query if you use
DataAdapter.

DataColumn:
- ColumnName : the name of the column as it appears in the query (if you
used DataAdapter)
- Caption : returns ColumnName unless it has been set to something else

If the DataGridColumnS tyles are auto-generated then:
- MappingName = DataColumn.Colu mnName
- HeaderText = DataColumn.Colu mnName

so that's why the HeaderText in the grid is the same as the column names in
your query.

If you create the column styles yourself, then you have to set MappingName
and HeaderText yourself. MappingName should be set to one of the
DataColumn's ColumnName and HeaderText can be set to whatever you want.
HTH,
Greetings

Nov 21 '05 #2
Thank you for the clarification.

If the query uses an "AS" qualifier like

SELECT column AS [A Column Name With Spaces]

Will the spaces mess anything up? I don't think so since it wants a
string, but just to clarify....

Nov 21 '05 #3
Hi,

"bordsby" <bo*****@gmail. com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com...
Thank you for the clarification.

If the query uses an "AS" qualifier like

SELECT column AS [A Column Name With Spaces]

Will the spaces mess anything up? I don't think so since it wants a
string, but just to clarify....
DataColumn.Colu mnName will be 'the column name with the spaces', it
shouldn't cause any problems. Though some people prefer not to use column
names or aliases that have spaces and do the formatting later (eg.
DataGridColumnS tyle.HeaderText ).
HTH,
Greetings

Nov 21 '05 #4
That seems like a better idea anyway, then I don't need the aliases...

I really appreciate the help.

Nov 21 '05 #5

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

Similar topics

3
18726
by: J | last post by:
Is there anyway to format a calculated datacolumn? I would like the following column to display as money (formatted as $#,##0.00). Or how about simply displaying the column formatted as a number with only 2 decimals (#,##0.00)? In the sample below, amount and taxrate are existing DataColumn's. DataColumn colTax = new DataColumn(); colTax.DataType = System.Type.GetType("System.String"); colTax.ColumnName = "tax";...
4
10098
by: Brian Brane | last post by:
I have properties that wrap DataRow columns as in: public int aNumber { get{ return m_DataRow; } set{ m_DataRow = value; } } If the column happens to contain DBNull, I get a cast exception since DBNull cannot be converted to int. I wrote the following method that looks up the column's data type and if it is a ValueType, returns the default value for the ValueType.
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...
6
4434
by: Nina | last post by:
Hi Everyone, I have made a windows application using vb.net 2003. When user opens this application it will display a default location in a textbox. This application has to allow user to change the default location and set their desired location as application’s new default. For instance, if the application’s default location is Chicago, every time user launches this program Chicago will be displayed in the textbox. If user...
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..
11
21916
by: Matt F | last post by:
I'm trying to do something that seems like it should be pretty simple, but haven't found a solution. I am trying to add a datacolumn to a datatable that adds or subtracts a number of days based on another datetime column in the table. See sample below. How do I do this? Any help would be greatly appreciated. Thanks Private Sub CreateDataTable() dt = New DataTable
3
24684
by: Manuel | last post by:
Hi to all, I'm trying to copy a Datacolumn from a table to another, but with this code: destTable.Columns.Add(srcTable.Column); I got this error: Column 'colname' already belongs to another DataTable. Anyone can help me?
1
1785
by: Mark Baldwin | last post by:
Steven Thanks for your reply, however the typed datasets are defined in the web service and there seems to way to open the partial class code window - double clicking on the design surface does nothing. I can do this in the client for a client specific dataset, but not in the web service. -- Best regards Mark Baldwin
3
3142
by: mnishani | last post by:
Is there any way to add a default value to a datagrid column(for the whole column - eg : system date) . I'm using vs2003 and datagrid and using dataadapter to update the grid. Thanks in advance
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
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
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
4606
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
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.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.