我有一个数据类别“商品,供应商和产品”的数据库。
我创建了一个模块来执行数据库操作,但是我对如何执行需要实现的功能了解不多。
代码:
namespace Model {
public class ProductDataSource : IDataSource<Product> {
private readonly SqlDataAdapter sqlDataAdapter;
public ProductDataSource() {
sqlDataAdapter = new SqlDataAdapter();
}
public void Delete(int id) {
const string sql = @"delete from Product
where id = @id";
SqlCommand command = new SqlCommand(sql);
sqlDataAdapter.DeleteCommand = command;
//sqlDataAdapter.Update();
}
public List<Product> GetAll() {
throw new NotImplementedException();
}
public Product GetById(int id) {
throw new NotImplementedException();
}
public Product Insert(Product newObject) {
throw new NotImplementedException();
}
public Product Update(Product updatedObject) {
throw new NotImplementedException();
}
}
}