yongyih
asked on
I want to set column header caption and data source of a DataGrid Control at run time.
I want to know how to set the data source of a data grid control at run time. my data source is an ADO recordset.
I try to use set DataGrid1.dataSouce=ADORec but it doesn't works. (No error)
Please give me the coding.
I try to use set DataGrid1.dataSouce=ADORec
Please give me the coding.
ASKER
sorry... i just found the solution.
after i add in this statement, the grid can display all the records from database.
.CursorLocation = adUseClient
Now online to delete this question. Since you post a comment already, how about you tell me how to set the caption of the DataGrid? The column header. Because it is follow the table fields name when display.
after i add in this statement, the grid can display all the records from database.
.CursorLocation = adUseClient
Now online to delete this question. Since you post a comment already, how about you tell me how to set the caption of the DataGrid? The column header. Because it is follow the table fields name when display.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
yongyih,
In the SQL you use to return the dataset redefine the headings using something like
SELECT lastname AS [Surname],
firstname AS [Christian Name]
FROM tblname
for example
In the SQL you use to return the dataset redefine the headings using something like
SELECT lastname AS [Surname],
firstname AS [Christian Name]
FROM tblname
for example
yongyih,
In the SQL you use to return the dataset redefine the headings using something like
SELECT lastname AS [Surname],
firstname AS [Christian Name]
FROM tblname
for example
In the SQL you use to return the dataset redefine the headings using something like
SELECT lastname AS [Surname],
firstname AS [Christian Name]
FROM tblname
for example
ryancys and stelamb already gave you correct comments.
BTW stelamb, welcome to EE but take some time to read https://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp. A valid comment was already posted (by ryancys). You should have post a comment.
BTW stelamb, welcome to EE but take some time to read https://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp. A valid comment was already posted (by ryancys). You should have post a comment.
ASKER
I cannot accept your comment as answer because ryancys already gave a correct answer. But your answer is correct and very useful too. thanks.
datagrid1.refresh