I have app, but have some simple solution.
Using this code to insert into sql and working fine.
But i have 2000 employes and have problem with database was too big when put inside pictures of all workers
I need some help or solution, to save some loaction with file name exmp. c:\some folder\imageofemployee.jpg
When click on datagrid row (selection changed) to show picture from that location
Not put in sql image, just file location.
Some help???
I hope to good explane
-
-
- byte[] img_arr = null;
- MemoryStream ms = new MemoryStream();
-
-
- bool isNullOrEmpty = pictureBox1 == null || pictureBox1.Image == null;
- if (!isNullOrEmpty)
- pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
- img_arr = ms.GetBuffer();
- using (SqlConnection openCon = new SqlConnection(cs))
- {
- string saveStaff = "declare @maxNo integer = 0 select @maxNo = isnull(max(redni_broj), 0) from [dbo].[radnici]; Set @maxNo=@maxNo+1; INSERT INTO dbo.radnici (redni_broj, data) VALUES (@maxNo,@data)";
-
- using (SqlCommand querySaveStaff = new SqlCommand(saveStaff))
- {
- querySaveStaff.Connection = openCon;
-
- querySaveStaff.Parameters.AddWithValue("@data", img_arr);
- openCon.Open();
- querySaveStaff.ExecuteNonQuery();
- openCon.Close();
- }