Click to See Complete Forum and Search --> : I need a good tutorial


cmore
March 12th, 2005, 11:35 AM
I need a good tutorial on how to make a windows application on add, edit, update, delete records in a database. If you could list any website that has great tutorial on C#.

Thanks

Ctwizzy
March 12th, 2005, 02:21 PM
You can do this multiple ways, I dont know of any tutorials. But I can try and nudge you in the right direction.

Method 1.
- Use a datagrid, a binded datagrid to your database will update all changes made, so hence additions, modify and delete will all work.

Method 2.
- Use Command Objects.
I have a class which has the following methods:

Open() - opens the connection

Close() - closes the connection

RetrieveDataSet() - creates a dataset and returns it

Update(strSQL) - accepts the string puts it in a command and use
ExecuteNonQuery()

Remove(strSQL) - same as above

Add(strSQL) - use execute here instead.

If you need help with this method I can help when I get back to work on monday if thats too late sorry :(

Method 3
- work directly with a dataSet
You can do add/remove and modify to the dataSet directly and then sync up with the DB upon close of your app

Here these links might help
http://www.codeproject.com/cs/database/

In particular for you:
This one got me started awesome, and has a second part at the bottom with even more help.
http://www.codeproject.com/cs/database/DatabaseAcessWithAdoNet1.asp

This one is good too.
http://www.codeproject.com/cs/database/relationaladonet.asp


Just remember the command Objects etc all have dif names depending on the Database your connecting too.

OleDbCommand is for say Access
there is also SQL and ODBC and some others im sure.

Good luck