• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Junilu Lacar
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst
  • Peter Rooke
  • Mikalai Zaikin
  • Himai Minh

DataConnections - Simple C# desktop app in Visual Studio

Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 Zdarko
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.

Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
Master Gardener Program
    Bookmark Topic Watch Topic
  • New Topic