Hello
I have a datagrid to show data for a database table using "seclect * from
tablename"
The datagrid works OK. However, I want to change the name of the fields in
the database to other name in DataGrid. For example, a field name in
database is "FName" will be shown in dataGrid as "First Name". Could you
please tell me how to do that
Thank you for your help
Best regards
S.Hoa 5 4235
Hi
If you use, instead of "SELECT * FROM tblTableA" which returns all fields
using their Field names;
"SELECT fldA AS Orders, fldB AS Suppliers FROM tblTableA Order By fldA"
the data table will use "Orders" as an Alias to the field name fldA and
"Suppliers" as an Alias to the field name fldA. It will also order the data
table by the records in the Field fldA.
"HS1" <so*@slingshot. co.nz> wrote in message
news:1096842002 .650824@ftpsrv1 ... Hello
I have a datagrid to show data for a database table using "seclect * from tablename"
The datagrid works OK. However, I want to change the name of the fields in the database to other name in DataGrid. For example, a field name in database is "FName" will be shown in dataGrid as "First Name". Could you please tell me how to do that
Thank you for your help Best regards S.Hoa
Hello
I already used Alias, However, if I do that the DataGrid will not display
any data (it shows "null"). I do not know how to set DataGrid to show the
Alias (in design form)
"Doug Bell" <dug@bigpond> wrote in message
news:uq******** ******@TK2MSFTN GP12.phx.gbl... Hi If you use, instead of "SELECT * FROM tblTableA" which returns all fields using their Field names; "SELECT fldA AS Orders, fldB AS Suppliers FROM tblTableA Order By fldA" the data table will use "Orders" as an Alias to the field name fldA and "Suppliers" as an Alias to the field name fldA. It will also order the
data table by the records in the Field fldA.
"HS1" <so*@slingshot. co.nz> wrote in message news:1096842002 .650824@ftpsrv1 ... Hello
I have a datagrid to show data for a database table using "seclect *
from tablename"
The datagrid works OK. However, I want to change the name of the fields
in the database to other name in DataGrid. For example, a field name in database is "FName" will be shown in dataGrid as "First Name". Could you please tell me how to do that
Thank you for your help Best regards S.Hoa
Hi,
I am a bit confused.
If you are using Select * then you are not using alias for field names.
With your example it would be:
"SELECT FName AS [First Name] FROM tablename"
the brackets are needed if you use spaces, keywords or special characters.
Doug
"HS1" <so*@slingshot. co.nz> wrote in message
news:1096843814 .417496@ftpsrv1 ... Hello I already used Alias, However, if I do that the DataGrid will not display any data (it shows "null"). I do not know how to set DataGrid to show the Alias (in design form)
"Doug Bell" <dug@bigpond> wrote in message news:uq******** ******@TK2MSFTN GP12.phx.gbl... Hi If you use, instead of "SELECT * FROM tblTableA" which returns all
fields using their Field names; "SELECT fldA AS Orders, fldB AS Suppliers FROM tblTableA Order By fldA" the data table will use "Orders" as an Alias to the field name fldA and "Suppliers" as an Alias to the field name fldA. It will also order the data table by the records in the Field fldA.
"HS1" <so*@slingshot. co.nz> wrote in message news:1096842002 .650824@ftpsrv1 ... Hello
I have a datagrid to show data for a database table using "seclect * from tablename"
The datagrid works OK. However, I want to change the name of the
fields in the database to other name in DataGrid. For example, a field name in database is "FName" will be shown in dataGrid as "First Name". Could
you please tell me how to do that
Thank you for your help Best regards S.Hoa
Thanks
I forget to tell you that I tried to use "Select FName As [FirtName]". When
I did that, in the DataGrid, the column is still "FName" and the value is
"null"
I think that I set wrong DataGrid
"Doug Bell" <dug@bigpond> wrote in message
news:uk******** ******@TK2MSFTN GP15.phx.gbl... Hi, I am a bit confused. If you are using Select * then you are not using alias for field names. With your example it would be: "SELECT FName AS [First Name] FROM tablename"
the brackets are needed if you use spaces, keywords or special characters.
Doug
"HS1" <so*@slingshot. co.nz> wrote in message news:1096843814 .417496@ftpsrv1 ... Hello I already used Alias, However, if I do that the DataGrid will not
display any data (it shows "null"). I do not know how to set DataGrid to show
the Alias (in design form)
"Doug Bell" <dug@bigpond> wrote in message news:uq******** ******@TK2MSFTN GP12.phx.gbl... Hi If you use, instead of "SELECT * FROM tblTableA" which returns all fields using their Field names; "SELECT fldA AS Orders, fldB AS Suppliers FROM tblTableA Order By
fldA" the data table will use "Orders" as an Alias to the field name fldA
and "Suppliers" as an Alias to the field name fldA. It will also order the
data table by the records in the Field fldA.
"HS1" <so*@slingshot. co.nz> wrote in message news:1096842002 .650824@ftpsrv1 ... > Hello > > I have a datagrid to show data for a database table using "seclect * from > tablename" > > The datagrid works OK. However, I want to change the name of the fields in > the database to other name in DataGrid. For example, a field name in > database is "FName" will be shown in dataGrid as "First Name". Could you > please tell me how to do that > > Thank you for your help > Best regards > S.Hoa > >
use a DataGridTableSt yle, then apply a DataGridColumnS tyle to it. You can
change this by manipulating the DataColumn's name, but I'd recommend against
doing that in most cases b/c you'll need to remember to use that Alias
everywhere and chances are you'll forget at some point (or some other
developer will) . http://www.knowdotnet.com/articles/cgrid.html
Also, unless you have a really small table and/or actually need every
column, stay away from SELECT * because you'll pull over a lot of data that
you don't need which is cached locally - this can be a real performance
killer. (Doug already mentioned using the aliases instead of SELECT *, I'm
just seconding that opinion)
--
W.G. Ryan MVP (Windows Embedded)
TiBA Solutions www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"HS1" <so*@slingshot. co.nz> wrote in message
news:1096852553 .230267@ftpsrv1 ... Thanks I forget to tell you that I tried to use "Select FName As [FirtName]".
When I did that, in the DataGrid, the column is still "FName" and the value is "null" I think that I set wrong DataGrid
"Doug Bell" <dug@bigpond> wrote in message news:uk******** ******@TK2MSFTN GP15.phx.gbl... Hi, I am a bit confused. If you are using Select * then you are not using alias for field names. With your example it would be: "SELECT FName AS [First Name] FROM tablename"
the brackets are needed if you use spaces, keywords or special
characters. Doug
"HS1" <so*@slingshot. co.nz> wrote in message news:1096843814 .417496@ftpsrv1 ... Hello I already used Alias, However, if I do that the DataGrid will not display any data (it shows "null"). I do not know how to set DataGrid to show the Alias (in design form)
"Doug Bell" <dug@bigpond> wrote in message news:uq******** ******@TK2MSFTN GP12.phx.gbl... > Hi > If you use, instead of "SELECT * FROM tblTableA" which returns all fields > using their Field names; > "SELECT fldA AS Orders, fldB AS Suppliers FROM tblTableA Order By fldA" > the data table will use "Orders" as an Alias to the field name fldA and > "Suppliers" as an Alias to the field name fldA. It will also order
the data > table by the records in the Field fldA. > > "HS1" <so*@slingshot. co.nz> wrote in message > news:1096842002 .650824@ftpsrv1 ... > > Hello > > > > I have a datagrid to show data for a database table using "seclect
* from > > tablename" > > > > The datagrid works OK. However, I want to change the name of the fields in > > the database to other name in DataGrid. For example, a field name
in > > database is "FName" will be shown in dataGrid as "First Name".
Could you > > please tell me how to do that > > > > Thank you for your help > > Best regards > > S.Hoa > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Alpha |
last post by:
I have several textboxes that I need to chang the text when the selection row
is changed in a datagrid. I have the following code. This textbox displayes
the initial selection but when I click on different rows in the datagrid, the
textbox content doesn't change to reflect the change. How can I address
this?
Also, If the user change the text in the textbox then how do I refesh the
display in the datagrid to reflect the changes?
...
|
by: Amber |
last post by:
There are times when you will need to highlight or otherwise modify
the contents of a particular DataGrid row-column value based upon the
value in the column. In this example we will select the CompanyName,
ContactName, and ContactTitle columns from the Customers table in the
Northwind database. Whenever the value of ContactTitle equals "Owner"
we will change the font color to red.
We can do this by using an ItemTemplate where we have...
|
by: J Sahoo |
last post by:
Hi,
I have a browse page where I am showing few fields from my SQL Server
table. One of the field is Image type, all the fields are bound to a
single table.
I want to show the image from the table on this browse along with the
other fields. Here is the code what I have from the HTML view, I am
using a datagrid to show the result. It does not show the image rather
it shows "System.Byte " on the output. I did not have any code
behind...
|
by: Harry Devine |
last post by:
I have a DataGrid that is configured to use the Edit/Update/Cancel concept
correctly. My grid shows values from 5 database fields. I only need to
update that last 4 fields. The last field is a Yes/No value in Access.
Using the OleDbCommand, if I do not consider the Yes/No field, the
ExecuteNonQuery command, using my UPDATE SQL statement, updates the record
correctly. However, if I put the Yes/No field into the mix, ExecuteNonQuery...
|
by: Red |
last post by:
Hi all,
I would like to ask how to combine 2 field into one
column.
For example I have field first name and last name. When I
show it to the datagrid I want to show it as one column,
for example first name: Jack, lastname: sun become Jack
sun.
Thanks
| |
by: Julius Fenata |
last post by:
Dear all,
I need help to change my item-template value format...
Here is my case, I have a datagrid, with 'SubjectPrice' field, and when the
grid displayed, my 'SubjectPrice' field displayed as this format:
$30,000.00, because I put it this format {0:C}.
I need to re-format as only this value (example: 30.000 - without currency,
without decimal & using dot for thousand separator). But how to re-format my
|
by: HS1 |
last post by:
Hello
I have a table in Access Database. This table has a AutoNumber field. I use
a DataGrid to show that table
When I insert a new record in for this table using a DataGrid, there is a
message that asks me to enter the value for this AutoNumber field. Why I
have to do that?
Could you please help
|
by: Larry Woods |
last post by:
I have a datagrid that is carrying all fields of a record...except one. Now
I want to update the underlying database via a dataadapter. The update is
working but the field that is "left out" is not there, of course. How do I
get that field back into the datatable for the database update?
TIA,
Larry Woods
|
by: remya1000 |
last post by:
i'm using VB.NET. and its a windows application.
in my program i need to display a table in datagrid. so i created the table using DataTable and i'm calling that dataTable to dataGrid. and its working fine...
but according to one of the field in that table i need to change the back color of that row. one of the field in that table called "Active", it will have value as True or False. so if Active =True then i need that corresponding row...
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |