Back to Blog
Database visual studio 2017 sql server7/20/2023 ![]() This is the method in the Data Access Layer: public override int Add(Slika entity, bool saveChanges = true) This is the method in the Business Logic Layer: public bool AddSlika(Slika slika) MessageBox.Show("Data saved successfully.") Images = binaryReader.ReadBytes((int)stream.Length) private void btnDodajSliku_Click(object sender, EventArgs e)įileStream stream = new FileStream(imgLocation, FileMode.Open, FileAccess.Read) īinaryReader binaryReader = new BinaryReader(stream) This I use to add the picture in a database. ![]() If (dialog.ShowDialog() = DialogResult.OK) OpenFileDialog dialog = new OpenFileDialog() ĭialog.Filter = " png files(*.png)|*.png|jpg files(*.jpg)|*.jpg|All files(*.*)|*.*" Private void btnPretraziSliku_Click(object sender, EventArgs e) This is the code I use to get the picture from the users PC and put in in a PictureBox: string imgLocation = "" Right now I am stuck with an error that says: I have been trying to add a picture from the user's PC to my SQL Server database through Visual Studio using C#, but I keep getting some kind of error.
0 Comments
Read More
Leave a Reply. |