posted 10 years ago
Hello.
I am creating a very simple desktop app using visual studio express for C#.
I have a database with two tables.
One is the header - it has an auto number field and a text name field.
The other table has 5 parts, auto number, IndexTableOne, Description, date, outdated(truefalse)
first table looks like this.
1 Section one
2 Section two
3 Section three
4 Section four
table two looks like this
1 1 bunchoftext 1/2/2012 no
2 1 bunchoftext 1/2/2012 no
3 2 bunchoftext 1/2/2012 no
4 3 bunchoftext 1/2/2012 no
5 1 bunchoftext 1/2/2012 no
6 4 bunchoftext 1/2/2012 no
I created a connection to the database using the menu options in Visual studio. I know I can do a bunch of drag and drop stuff but I want to be able to go into the code and make a new data set and run SQL queries on the existing data connection.
The current data connection is called _implimentDataSet and shows both tables inside of it.
The application will have a drop down box that will be populated by a database (table one). When I select a section in the drop down, I want the table to only show the second table in a dataview of only that section.
if I select section one I want to have the dataview show only where the second field is 1.
So I want a sql statement
Select *
From _implimentDataSet
WHERE fieldone = fieldtwo
I can handle the SQL statement, what I want to know is how to make a method that when my drop down changes that it will select do this.
My problem.
How to I make a dataset? I do not want to use menus and drag n drop, I want to write this in code.
So far I have DataSet ds = new DataSet();
now how do I make this new dataset to look in the _implimentDataSet that has been created?
Thank you.
-Bill