Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
this is the code in business logic can you tell how to write sqlhelper

C#
public class BusinessLogic
    {
       string name, gender, city;
       public string Name
       {
           get { return name; }
           set { name = value; }
       }
       public string Gender
       {
           get { return gender; }
           set { gender = value; }
       }
       public string City
       {
           get { return city; }
           set { city = value; }
       }
       int id;
       public int Id
       {
           get { return id; }
           set { value = id; }
       }
       public void AddEmployee()
       {
           SqlParameter[] p=new SqlParameter[4];
           p[0] = new SqlParameter("@EmployeeId", this.id);
           p[0].DbType = DbType.String;
           p[1] = new SqlParameter("@Name",this.name);
           p[1].DbType = DbType.String;
           p[2] = new SqlParameter("@Gender",this.gender);
           p[2].DbType = DbType.String;
           p[3] = new SqlParameter("@City",this.city);
       }
Posted
Updated 14-Apr-14 7:52am
v2

1 solution

Depends on how SQLHelper has been implemented.
By using command parameters, you seem to be on the right track.
 
Share this answer
 
Comments
Manas Bhardwaj 14-Apr-14 13:53pm    
I am not sure if he is.

To me it looks like, it was one of those code review comments to refactor the code and add a SQL Helper class. ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900