Background
I am writing my first c# application, and would like to display the results of an SQL query in my application.
I would like the query to run against the database on a button click event. The results are to be displayed as read only and I would like them to be displayed in a table, not text boxes.
Form
What I have managed to create so far by drag and dropping from the 'ToolBar' in Visual Studio 2014.
SQL query
select * from station
This isn't my exact query but it doesn't differ much as is still a select statement.
What I have done so far
- Connected a dataset which includes the table I want to run the query on.
- Added datagridview
- Added button
Question
Could some one point me in the right direction? I don't necessarily want someone to write the code just advise what the next step is.
What do I do next?
My guess
I create some kind of event on button click that runs the query and brings back the records in the datagridview?
I have no idea how to do the above is it is correct however.