-
April 20th, 2013, 04:12 PM
#1
[RESOLVED] Column pulling of a database
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:
string query = "SELECT * FROM CJIS_JAIL_PARTIES";
SqlConnection connString = new SqlConnection(connectionString);
//Run query
SqlCommand execution = new SqlCommand(query, connString);
//Execute the SQL DataReader
SqlDataReader executionReader = execution.ExecuteReader();
//Create DataTable to hold data returned from query
DataTable dataTable = new DataTable();
//Create DataTable.Load(SqlDataReader) to put the results of the query into a DataTable
dataTable.Load(executionReader);
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|