예제 #1
0
    public void InsertState(BALState obj)
    {
        query = "insert into State(statename) values ('" + obj.StateName + "')";
        SqlCommand cmd = new SqlCommand(query, con);

        con.Open();
        cmd.ExecuteNonQuery();
        con.Close();
    }
예제 #2
0
    public void UpdateState(BALState obj)
    {
        query = "update State set statename='" + obj.StateName + "' where stateid=" + obj.StateId;

        SqlCommand cmd = new SqlCommand(query, con);

        con.Open();
        cmd.ExecuteNonQuery();
        con.Close();
    }
예제 #3
0
    public void DeleteState(BALState obj)
    {
        query = "delete from State where stateid=" + obj.StateId;

        SqlCommand cmd = new SqlCommand(query, con);

        con.Open();
        cmd.ExecuteNonQuery();
        con.Close();

    }
예제 #4
0
    public DataSet SelectStateByStateId(BALState obj)
    {
        query = "select * from State where stateid="+obj.StateId;

        DataSet ds = new DataSet();

        SqlDataAdapter adp = new SqlDataAdapter(query, con);
        adp.Fill(ds);

        return ds;


    }
    public void insertState(BALState obj)
    {
        SqlCommand cmd = new SqlCommand();

        cmd.Connection  = con;
        cmd.CommandText = "spInsertState";
        cmd.CommandType = CommandType.StoredProcedure;

        cmd.Parameters.AddWithValue("@statename", obj.StateName);

        con.Open();
        cmd.ExecuteNonQuery();
        con.Close();
    }