Ok. I've been working on this project for a while and I've looked everywhere from stackoverflow to MSDN for a way to pull columns from a database. I want to format each column to a prefixed length. Any way that I can be able to call the columns of a DataTable to a individual variables as to call them by their variable name? If so, how would this be done? I'm completely new and I've been learning C# on my own. Please help???? :) Here is relevant code:

I'm not looking to export/import because I'm trying to write it to a preformatted file.

April 20th, 2013, 09:32 PM

dglienna

Re: Column pulling of a database

What format is returned? Probably loses the formatting...

April 22nd, 2013, 07:31 AM

sotoasty

Re: Column pulling of a database

What do you do with the datatable? Does it have to be in a data table? If not, create an entity class that mimics the database table, and use a reader to populate the class. Create a collection, or list of your entity class for the rows. Then you can call the variables anything you want.

April 22nd, 2013, 07:41 AM

dak45309

Re: Column pulling of a database

Thank you. That helps a lot :) I'm know most basic and some advanced stuff. This is what I was looking for. Thank you :)