Updating dataset c

Open(); Now we setup our adapterstring Parent Query = "SELECT * FROM Parent Table";string Child Query = "SELECT * FROM Child Table"; Sql Data Adapter Parent Adapter = new Sql Data Adapter(Parent Query, Connection); Sql Data Adapter Child Adapter = new Sql Data Adapter(Child Query, Connection); At this point we can fill our Data Set. Fill(My Data Set, "Child Table"); We have 1 Data Set with 2 Data Tables in it, Parent Table and Child Table. This means when you merge your 2 Data Sets nothing will get written to your database because nothing has changed.

It is also good in that it is directly tied to the dataset itself.

So if we modify the dataset, the listbox automatically changes as well.

Nothing much to see here other than how to create the class and use a connection string to tell the connection where to find the database.

Since we now have a database connection made, we have a few choices on how to query and load our data. Some have their advantages and disadvantages, so be sure to research which one might fit your needs the most.

All we need is to tell it which driver to use and where to find the database file. Then we give it the connection string and open the connection…

If this had been a database like My SQL located on another server, we would have to specify IP address info as well as port. Notice in our code above we create a new Ole Db Connection and give it a connection string to tells it where to find and to use our OLEDB 4.0 driver.

So grab a drink, kick off your shoes and lets play with some snippets here on the Programming Underground!

So how do we get this stupid name column out of our table “Employees” of the access database and into a control? One is to connect to the database, another thing is to query the database for the info and lastly we put that info into our source control… Connecting to the database is pretty straight forward and really starts out with picking the right connection object from the System. Since Access can be “accessed” through the OLEDB setup we can use the Ole Db Connection class for that. This is nothing but a string that tells the class where to find the database, what driver (or DSN) to use, any username and passwords to login to the database, and any security features we will need to implement for our access.

The Data Adapter will use our connection (a well???

Tags: , ,