locked
How to connect to SQL server in C# RRS feed

  • Question

  •  

    Hi anybody !

    I'm doing my project but it face some problem. i want to create a class to connect to a databse table. for example:

     In database you have a table name: Customer. now you create a class have name: tblCustomer. this class have methods to access to Customer table.

    Can you give me some idear to solve this problem. if you have code please post up with me. Thanks alot

    Tuesday, May 6, 2008 4:59 AM

Answers

  • In case i wanted to create classes that reflect my database schema (eg: tblCustomer) i would not create them myself, i'd use one of the many available generators to do that for me...

    For a simple application it suffices to launch visual studio, create a project, add a dataconnection, and drop one of the tables on the designer form.. This will generate code that represents the table, code that is capable of doing create-read-update-delete (crud) operations and even loading from db->ui and vice versa.

    Read connecting to data in visual studio for more information....
    Tuesday, May 6, 2008 5:37 AM

All replies

  • In case i wanted to create classes that reflect my database schema (eg: tblCustomer) i would not create them myself, i'd use one of the many available generators to do that for me...

    For a simple application it suffices to launch visual studio, create a project, add a dataconnection, and drop one of the tables on the designer form.. This will generate code that represents the table, code that is capable of doing create-read-update-delete (crud) operations and even loading from db->ui and vice versa.

    Read connecting to data in visual studio for more information....
    Tuesday, May 6, 2008 5:37 AM