wood burning stoves 2.0*
The moose likes C / C++ and the fly likes DataConnections - Simple C# desktop app in Visual Studio Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » C / C++
Bookmark "DataConnections - Simple C# desktop app in Visual Studio" Watch "DataConnections - Simple C# desktop app in Visual Studio" New topic
Author

DataConnections - Simple C# desktop app in Visual Studio

Bill Zdarko
Greenhorn

Joined: Aug 11, 2012
Posts: 5
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
Bill Zdarko
Greenhorn

Joined: Aug 11, 2012
Posts: 5
Or

if it is much easier in a visual view, can I get a step by step on how to make a change in a dropdown effect the contents of a datagridview.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DataConnections - Simple C# desktop app in Visual Studio