Sunday, April 26, 2009

OOP-Insert Record to Database - c#

This is a simple example to show how to insert record to database. Database is created in sqlserver. This is a major problem where beginers face in OO programming in c#, where they don’t know how to separate layers and do the standerd coding.

This example shows how to insert record to database and as well as the oo progaramming style.
Try it and have an idea.

The only changes you have to make is change the server name(amila-pc\).
“using (SqlConnection conn = new SqlConnection(@"Data Source=amila-pc\sqlexpress;Initial Catalog=Employee;Integrated Security=True"))”

Download
Source code


5 comments: