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:

  1. Hey what if we need to use a different port?

    ReplyDelete
  2. Ohh Nice Work... Keep Posting ;)

    ReplyDelete
  3. different port... I don't get your problem..

    ReplyDelete