// xu ly anh private void Xulyanh(string maluuanh) { OpenFileDialog dialog = new OpenFileDialog(); string CorrectFileName = Path.GetFileName(FileName); string CorrectFileName1 = Path.GetFileName(FileName1); string CorrectFileName2 = Path.GetFileName(FileName2); string link = "\\Picture\\" + CorrectFileName; string link1 = "\\Picture\\" + CorrectFileName1; string link2 = "\\Picture\\" + CorrectFileName2; DTO_Khoanh ka = new DTO_Khoanh(buska.TaoMa(), maluuanh, link); string paths = Application.StartupPath.Substring(0, (Application.StartupPath.Length - 10)); File.Copy(FileName, paths + "\\Picture\\" + CorrectFileName); File.Copy(FileName1, paths + "\\Picture\\" + CorrectFileName1); File.Copy(FileName2, paths + "\\Picture\\" + CorrectFileName2); buska.InsertDB(ka); DTO_Khoanh ka1 = new DTO_Khoanh(buska.TaoMa(), maluuanh, link1); buska.InsertDB(ka1); DTO_Khoanh ka2 = new DTO_Khoanh(buska.TaoMa(), maluuanh, link2); buska.InsertDB(ka2); }
public bool InsertDB(DTO_Khoanh ka) { string sql = string.Format("insert into DBimage(IM,ID,Path) values('{0}','{1}','{2}')", ka.IM, ka.ID, ka.Anh); if (daotv.NonQuery(sql)) { return(true); } return(false); }