Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate a datagrid with code

Status
Not open for further replies.

rtshort

IS-IT--Management
Feb 28, 2001
878
US
What is the best code to populate a DataGrid with code from a database and get the total(currency) from the last column?? Can someone give me a little sample code please? Every day above ground is a GOOD DAY!!!
 
I should have said the best way to populate a datagrid with code, not the best code.

Any takers??? Every day above ground is a GOOD DAY!!!
 
Are you familiar with ado Controls? The best way I have found to populate a datagrid is using an ado Control to retrieve the data then binding the datagrid to the ado control. Then you can run a loop to total the your currency column. Using an ado control is quicker and cleaner. If you need help in setting an ado control let me know, I will skip the details for now.
 
I know a little about controls, but in the project I'm working on, the database that the information needs to come from will not be determined until the user has completed information on a seperate form. That form will determine which database needs to be used. From there I want to put the items selected on a DataGrid and get a total in the last column for the amount of purchase. Kind of like an invoice.

Thx Every day above ground is a GOOD DAY!!!
 
Will the nubmer of fields and fields be the same when you call different databases or will they be different?

 
The number of fields will remain the same. (Item#, Desc, Quan, Price) Every day above ground is a GOOD DAY!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top