473,402 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

saving images after editing,that time saving only last edited images in winform appli

i have a data grid view like this:
in cell content click i wrote code like this:
Expand|Select|Wrap|Line Numbers
  1. If e.ColumnIndex = 4 Then
  2.             Dim OFDLogo As New OpenFileDialog()
  3.             OFDLogo.Filter = "JPEG(*.jpg)|*.jpg|BMP(*.bmp)|*.bmp"
  4.             If OFDLogo.ShowDialog() = DialogResult.OK Then
  5.                 gv.Rows(e.RowIndex).Cells(4).Value = Image.FromFile(OFDLogo.FileName)
  6.             End If
  7.         End If
and save button i wrote code like this:
Expand|Select|Wrap|Line Numbers
  1. Dim cmpny As String = "Delete from CompanyMaster_tbl"
  2.         Exetransaction(cmpny)
  3.     For i As Integer = 0 To gv.RowCount - 2
  4.      sqlInsertT2 = "Insert Into DepartmentMaster_tbl(dtname,dtphone,dtEmail,Cid) Values ('" + myTI.ToTitleCase(gv.Rows(i).Cells(1).Value) + "','" + gv.Rows(i).Cells(2).Value + "','" + gv.Rows(i).Cells(3).Value + "'," & Ccid & ");"
  5.                     Exetransaction(sqlInsertT2)
  6.                     Dim departmnt As String = gv.Rows(i).Cells(1).Value
  7.  
  8.                     Dim departid As Integer = RecordID("dtId", "DepartmentMaster_tbl", "dtName", departmnt)
  9.                     Dim sql As String
  10.  
  11.                     '----------------------------------
  12.  
  13.                     Dim image As Image = TryCast(gv.Rows(i).Cells(4).Value, Image)
  14.                     If image IsNot Nothing Then
  15.                         Dim ms As New MemoryStream()
  16.                         image.Save(ms, System.Drawing.Imaging.ImageFormat.Gif)
  17.                         Dim imagedata As Byte() = ms.ToArray()
  18.                         sql = "update DepartmentMaster_tbl set empimage=@photo where dtId='" & departid & "'"
  19.                         Dim cmd As New SqlCommand(sql, con.connect)
  20.                         cmd.Parameters.Add("@photo", SqlDbType.Image)
  21.                         cmd.Parameters("@photo").Value = imagedata
  22.                         cmd.ExecuteNonQuery()
  23.                         con.disconnect()
  24.                     End If
  25.      Next
In first time I try to save this,saving both images, after loading the same page again I edited one image and I try to save, but that time only saving edited image What is wrong with my code?
In cell content click I am taking row_index
Attached Images
File Type: jpg byte.jpg (31.3 KB, 91 views)
Jan 22 '14 #1
0 837

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: delerious | last post by:
I'm going to build a vertical navigation menu using images in HTML. I want to have a drop-down menu appear next to an image when I move the mouse over it. I know that I could just download any one...
8
by: Chris Dunaway | last post by:
When using a PropertyGrid, I have an object with a Date property, but I am only interested in the Time portion. How do I make the PropertyGrid allow editing the time only? Just the hours and...
1
by: magix | last post by:
Hi, Do you have any javascript available for changing images according to time ? let say Morning (7am-12pm), using images 1 (e.g morning.jpg) Afternoon (12 - 6pm), using images 2 (e.g...
2
by: mensuur | last post by:
hi, is there a way in which one can write the last edited date in a .aspx file onto a pae without physically writing e.g. <%response.write(request.datetime...)%> thanks a bundle -- mensuur
3
by: vj | last post by:
how to change images based on action. Even clicking changed images should do respective actions. and while displaying only one image at a time sholud get displayed. I am using three images for a...
4
by: SoulSeeker | last post by:
Hello. How I can start my M$ access form with last edited record? What I must put in "on load" field? Tnx. for advice.
1
by: Hermes | last post by:
I know SQL Server has a bunch of system tables that have interesting little tidbits of info in them, is there any way to tell who last edited a stored procedure or view, and when they did it? ...
1
anfetienne
by: anfetienne | last post by:
hi, im using the web resizer api to use as an online image editor for a project. i've got everything working up until the point where i need to save the images from the api server and i cant think of...
4
by: visweswaran2830 | last post by:
Hi, How can I get time of last request Sent in asp.net.. Actually I want to set automatic Idle timeout. So I planned to compare this time with current. Please Help me. Other solutions are also...
0
by: peyenko | last post by:
I am working on an iOS application and I need to find some information about building an app that can read text and images using the camera. I am looking for good resources that either have tutorials...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.