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 4220
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**************@TK2MSFTNGP12.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**************@TK2MSFTNGP12.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**************@TK2MSFTNGP15.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**************@TK2MSFTNGP12.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 DataGridTableStyle, then apply a DataGridColumnStyle 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**************@TK2MSFTNGP15.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**************@TK2MSFTNGP12.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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |