Getting info to display properly in datagridview from database in c#
I have a weird problem on my hand. I am trying to read an oracle database and using some queries to get info back. I have a datagridview with column names already set at the beginning of the program. Here is an example setup of my datagridview columns
Number Word Sentence Paragraph
Now i am reading a database and selecting its columns named N S P representing Number Sentence and Paragraph respectively. How can i load the results of the query into a datatable and display 开发者_运维问答the contents under my datagridview so the N contents in the database are displayed under the Number column and nothing under word column etc. I can always query by selecting N, S and P one at a time, but i want to load all the data at once.
THanks
You can change the column names in the SQL by writing
SELECT N AS Number, S AS Sentence, ...
精彩评论