简体   繁体   中英

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 NSP 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

您可以通过以下方式更改SQL中的列名称:

SELECT N AS Number, S AS Sentence, ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM