Jump to content

The process cannot access the file

- - - - -

  • Please log in to reply
4 replies to this topic

#1
TheWebGuy

TheWebGuy

    Newbie

  • Members
  • Pip
  • 7 posts
don't know why this does this on the delete.

any ideas?





---------------------------------------------
The process cannot access the file 'D:\InetPub\ReefJunkies\Users\bill\Profile\Picture Thumb\340x_la-rouxsmall.jpg' because it is being used by another process.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.IOException: The process cannot access the file 'D:\InetPub\ReefJunkies\Users\bill\Profile\Picture Thumb\340x_la-rouxsmall.jpg' because it is being used by another process.

Source Error:

Line 174: Dim fd2 As New FileInfo(OldPath2)
Line 175: If fd2.Exists = True Then
Line 176: fd2.Delete()
Line 177: End If
Line 178: End If

---------------------------------------------






1. insertion code
2.
3.
4.
5.
6. 'upload picture
7. Dim PictureThumbpass
8. Dim PicturePass
9.
10. Dim fileLen As Integer
11. Dim myStream As System.IO.Stream
12. Dim ImgContentType As String
13. Dim UserName = NickName.Text
14.
15. Dim FileUploadPicture As FileUpload = FileUploadProfilePhoto
16.
17. 'Response.Write(FileUploadPicture.HasFile)
18. 'Response.End()
19.
20. If FileUploadPicture.HasFile Then
21. 'Create Dir
22. Dim nd As New DirectoryInfo(Server.MapPath("\" + Application("SysUserDir") & "\" & UserName & "\Profile\Picture\"))
23. If nd.Exists = False Then
24. nd.Create()
25. End If
26.
27. 'Create Dir
28. Dim nd2 As New DirectoryInfo(Server.MapPath("\" + Application("SysUserDir") & "\" & UserName & "\Profile\PictureThumb\"))
29. If nd2.Exists = False Then
30. nd2.Create()
31. End If
32.
33.
34.
35. fileLen = FileUploadPicture.PostedFile.ContentLength
36. ImgContentType = FileUploadPicture.PostedFile.ContentType
37.
38. Dim Input(fileLen) As Byte
39. myStream = FileUploadPicture.PostedFile.InputStream
40. myStream.Read(Input, 0, fileLen)
41.
42. 'Response.Write(fileLen)
43. 'Response.End()
44.
45. Dim Filename = FileUploadPicture.PostedFile.FileName
46.
47. Dim Path1 = Server.MapPath("\" + Application("SysUserDir") & "\" & UserName & "\Profile\Picture\" & Filename)
48. Dim DataPath1 = "/" & UserName & "/Profile/Picture/" & Filename
49.
50. Dim Path2 = Server.MapPath("\" + Application("SysUserDir") & "\" & UserName & "\Profile\PictureThumb\" & Filename)
51. Dim DataPath2 = "/" & UserName & "/Profile/PictureThumb/" & Filename
52.
53.
54. If File.Exists(Path1) Or File.Exists(Path2) Then
55.
56. 'LabelPhotos.Text = "Photo has not been added to the system"
57. 'LabelConfirm.Text = "This photo image already exists in the system"
58. LabelRegisterDone.Text = "<h2><font color=#FF0000>Registration Failure</font></h2><br>This File Already Exists<br><br>"
59. MultiViewRegister.SetActiveView(ViewRegisterDone)
60. e.Cancel = True
61.
62. Else
63.
64.
65.
66. 'LabelConfirm.Text = ""
67. Dim PictureInfoLarge = System.Drawing.Image.FromStream(myStream)
68.
69.
70.
71.
72. 'Get Picture To be Resized large
73. Dim maxWidth1 As Integer = 800
74. Dim maxHeight1 As Integer = 800
75. Dim imgHeight1, imgWidth1 As Integer
76. 'Dim PictureInfo
77.
78.
79.
80. imgHeight1 = PictureInfoLarge.Height
81. imgWidth1 = PictureInfoLarge.Width
82.
83.
84. ' Determine Scaling
85. If imgWidth1 >= maxWidth1 Or imgHeight1 >= maxHeight1 Then
86. 'Determine what dimension is off by more
87. Dim deltaWidth1 As Integer = imgWidth1 - maxWidth1
88. Dim deltaHeight1 As Integer = imgHeight1 - maxHeight1
89. Dim scaleFactor1 As Double
90.
91. If deltaHeight1 > deltaWidth1 Then
92. 'Scale by the height
93. scaleFactor1 = maxHeight1 / imgHeight1
94. Else
95. 'Scale by the Width
96. scaleFactor1 = maxWidth1 / imgWidth1
97. End If
98.
99. imgWidth1 *= scaleFactor1
100. imgHeight1 *= scaleFactor1
101.
102. Else
103.
104.
105. End If
106.
107. 'Dim objThumbnail As System.Drawing.Image = PictureInfoLarge.GetThumbnailImage(imgWidth1, imgHeight1, Nothing, System.IntPtr.Zero)
108. Dim objThumbnail As System.Drawing.Bitmap = PictureInfoLarge.GetThumbnailImage(imgWidth1, imgHeight1, Nothing, System.IntPtr.Zero)
109. ' Dim graphicsImage As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(objThumbnail)
110.
111. '---------------supposed to fix -----------------------------------
112. Dim graphicsImage As Graphics
113. graphicsImage = Graphics.FromImage(objThumbnail)
114. graphicsImage.SmoothingMode = Drawing.Drawing2D.SmoothingMode.HighQuality
115. graphicsImage.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
116. graphicsImage.DrawImage(objThumbnail, 0, 0, imgWidth1, imgHeight1)
117. '--------------------------------------------------------------------
118. graphicsImage.Save()
119.
120. objThumbnail.Save(Path1, Imaging.ImageFormat.Jpeg)
121.
122.
123. graphicsImage.Dispose()
124.
125. PicturePass = DataPath1
126. 'e.Values("Picture") = DataPath1
127.
128. PictureInfoLarge = Nothing
129. objThumbnail = Nothing
130.
131.
132. Dim PictureInfoSmall = System.Drawing.Image.FromStream(myStream)
133.
134.
135. 'Get Picture To be Resized small
136. Dim maxWidth2 = 150
137. Dim maxHeight2 = 150
138. 'imgHeight, imgWidth As Integer
139. 'Dim PictureInfo
140.
141.
142.
143. Dim imgHeight2 = PictureInfoSmall.Height
144. Dim imgWidth2 = PictureInfoSmall.Width
145.
146. ' Determine Scaling
147. If imgWidth2 >= maxWidth2 Or imgHeight2 >= maxHeight2 Then
148. 'Determine what dimension is off by more
149. ' Dim deltaWidth As Integer = imgWidth - maxWidth
150. 'Dim deltaHeight As Integer = imgHeight - maxHeight
151. ' Dim scaleFactor As Double
152. Dim deltaWidth2 As Integer = imgWidth2 - maxWidth2
153. Dim deltaHeight2 As Integer = imgHeight2 - maxHeight2
154. Dim scaleFactor2 As Double
155.
156. If deltaHeight2 > deltaWidth2 Then
157. 'Scale by the height
158. scaleFactor2 = maxHeight2 / imgHeight2
159. Else
160. 'Scale by the Width
161. scaleFactor2 = maxWidth2 / imgWidth2
162. End If
163.
164. imgWidth2 *= scaleFactor2
165. imgHeight2 *= scaleFactor2
166.
167. Else
168.
169. End If
170.
171.
172. Dim objThumbnail2 As System.Drawing.Bitmap = PictureInfoSmall.GetThumbnailImage(imgWidth2, imgHeight2, Nothing, System.IntPtr.Zero)
173.
174. '---------------supposed to fix -----------------------------------
175. Dim graphicsImage2 As Graphics
176. graphicsImage2 = Graphics.FromImage(objThumbnail2)
177. graphicsImage2.SmoothingMode = Drawing.Drawing2D.SmoothingMode.HighQuality
178. graphicsImage2.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
179. graphicsImage2.DrawImage(objThumbnail2, 0, 0, imgWidth2, imgHeight2)
180. '--------------------------------------------------------------------
181. graphicsImage2.Save()
182.
183. objThumbnail2.Save(Path2, Imaging.ImageFormat.Jpeg)
184.
185. graphicsImage2.Dispose()
186.
187. PictureThumbpass = DataPath2
188. 'e.Values("PictureThumb") = DataPath2
189.
190.
191. myStream.Close()
192. myStream.Dispose()
193.
194. PictureInfoSmall = Nothing
195. objThumbnail2 = Nothing
196.
197.
198.
199.
200.
201.
202.
203. End If
204.
205.
206. ElseIf Not FileUploadPicture.HasFile Then
207.
208.
209. End If
210.
211.
212.
213. Update Code, almost the same
214.
215.
216.
217.
218.
219.
220.
221.
222.
223.
224. Protected Sub SuperFormPersonalInformation_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles SuperFormPersonalInformation.ItemUpdating
225.
226.
227.
228. Dim fileLen As Integer
229. Dim myStream As System.IO.Stream
230. Dim ImgContentType As String
231. Dim UserName = Dal.GetNickName(Dal.GetUserID)
232.
233. Dim FileUploadPicture As FileUpload = SuperFormPersonalInformation.FindControl("FileUploadEditPicture")
234.
235. 'Response.Write(FileUploadPicture.HasFile)
236. 'Response.End()
237.
238. If FileUploadPicture.HasFile Then
239. 'Create Dir
240. Dim nd As New DirectoryInfo(Server.MapPath("\" + Application("SysUserDir") & "\" & UserName & "\Profile\Picture\"))
241. If nd.Exists = False Then
242. nd.Create()
243. End If
244.
245. 'Create Dir
246. Dim nd2 As New DirectoryInfo(Server.MapPath("\" + Application("SysUserDir") & "\" & UserName & "\Profile\PictureThumb\"))
247. If nd2.Exists = False Then
248. nd2.Create()
249. End If
250.
251.
252.
253. fileLen = FileUploadPicture.PostedFile.ContentLength
254. ImgContentType = FileUploadPicture.PostedFile.ContentType
255.
256. Dim Input(fileLen) As Byte
257. myStream = FileUploadPicture.PostedFile.InputStream
258. myStream.Read(Input, 0, fileLen)
259.
260. 'Response.Write(fileLen)
261. 'Response.End()
262.
263. Dim Filename = FileUploadPicture.PostedFile.FileName
264.
265. Dim Path1 = Server.MapPath("\" + Application("SysUserDir") & "\" & UserName & "\Profile\Picture\" & Filename)
266. Dim DataPath1 = "/" & UserName & "/Profile/Picture/" & Filename
267. Dim OldPath1 = Server.MapPath("/" & Application("SysUserDir") & "/" & e.OldValues("Picture"))
268.
269. Dim Path2 = Server.MapPath("\" + Application("SysUserDir") & "\" & UserName & "\Profile\PictureThumb\" & Filename)
270. Dim DataPath2 = "/" & UserName & "/Profile/PictureThumb/" & Filename
271. Dim OldPath2 = Server.MapPath("/" & Application("SysUserDir") & "/" & e.OldValues("PictureThumb"))
272.
273.
274. 'Response.Write(DataPath1 & " " & DataPath2)
275. 'Response.End()
276. 'delete old image
277.
278. 'delete old files
279. If FileUploadPicture.HasFile Then
280. Dim fd1 As New FileInfo(OldPath1)
281. If fd1.Exists = True Then
282. fd1.Delete()
283. End If
284. End If
285.
286. If FileUploadPicture.HasFile Then
287. Dim fd2 As New FileInfo(OldPath2)
288. If fd2.Exists = True Then
289. fd2.Delete()
290. End If
291. End If
292.
293.
294.
295.
296.
297. If File.Exists(Path1) Or File.Exists(Path2) Then
298.
299. 'LabelPhotos.Text = "Photo has not been added to the system"
300. LabelConfirmPersonalInfo.Text = "This photo image already exists in the system"
301. e.Cancel = True
302.
303. Else
304.
305.
306.
307. LabelConfirmPersonalInfo.Text = ""
308. Dim PictureInfoLarge = System.Drawing.Image.FromStream(myStream)
309.
310.
311.
312.
313. 'Get Picture To be Resized large
314. Dim maxWidth1 As Integer = 800
315. Dim maxHeight1 As Integer = 800
316. Dim imgHeight1, imgWidth1 As Integer
317. 'Dim PictureInfo
318.
319.
320.
321. imgHeight1 = PictureInfoLarge.Height
322. imgWidth1 = PictureInfoLarge.Width
323.
324.
325. ' Determine Scaling
326. If imgWidth1 >= maxWidth1 Or imgHeight1 >= maxHeight1 Then
327. 'Determine what dimension is off by more
328. Dim deltaWidth1 As Integer = imgWidth1 - maxWidth1
329. Dim deltaHeight1 As Integer = imgHeight1 - maxHeight1
330. Dim scaleFactor1 As Double
331.
332. If deltaHeight1 > deltaWidth1 Then
333. 'Scale by the height
334. scaleFactor1 = maxHeight1 / imgHeight1
335. Else
336. 'Scale by the Width
337. scaleFactor1 = maxWidth1 / imgWidth1
338. End If
339.
340. imgWidth1 *= scaleFactor1
341. imgHeight1 *= scaleFactor1
342.
343. Else
344.
345.
346. End If
347.
348. 'Dim objThumbnail As System.Drawing.Image = PictureInfoLarge.GetThumbnailImage(imgWidth1, imgHeight1, Nothing, System.IntPtr.Zero)
349. Dim objThumbnail As System.Drawing.Bitmap = PictureInfoLarge.GetThumbnailImage(imgWidth1, imgHeight1, Nothing, System.IntPtr.Zero)
350. ' Dim graphicsImage As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(objThumbnail)
351.
352. '---------------supposed to fix -----------------------------------
353. Dim graphicsImage As Graphics
354. graphicsImage = Graphics.FromImage(objThumbnail)
355. graphicsImage.SmoothingMode = Drawing.Drawing2D.SmoothingMode.HighQuality
356. graphicsImage.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
357. graphicsImage.DrawImage(objThumbnail, 0, 0, imgWidth1, imgHeight1)
358. '--------------------------------------------------------------------
359. graphicsImage.Save()
360.
361. objThumbnail.Save(Path1, Imaging.ImageFormat.Jpeg)
362.
363. 'Response.Write(objThumbnail.PixelFormat & "<BR><BR>")
364. 'Response.Write(objThumbnail.PhysicalDimension)
365. 'Response.Write(objThumbnail.Size)
366.
367. 'Response.End()
368.
369.
370. graphicsImage.Dispose()
371.
372. e.NewValues("Picture") = DataPath1
373.
374. PictureInfoLarge = Nothing
375. objThumbnail = Nothing
376.
377.
378. Dim PictureInfoSmall = System.Drawing.Image.FromStream(myStream)
379.
380.
381. 'Get Picture To be Resized small
382. Dim maxWidth2 = 150
383. Dim maxHeight2 = 150
384. 'imgHeight, imgWidth As Integer
385. 'Dim PictureInfo
386.
387.
388.
389. Dim imgHeight2 = PictureInfoSmall.Height
390. Dim imgWidth2 = PictureInfoSmall.Width
391.
392. ' Determine Scaling
393. If imgWidth2 >= maxWidth2 Or imgHeight2 >= maxHeight2 Then
394. 'Determine what dimension is off by more
395. ' Dim deltaWidth As Integer = imgWidth - maxWidth
396. 'Dim deltaHeight As Integer = imgHeight - maxHeight
397. ' Dim scaleFactor As Double
398. Dim deltaWidth2 As Integer = imgWidth2 - maxWidth2
399. Dim deltaHeight2 As Integer = imgHeight2 - maxHeight2
400. Dim scaleFactor2 As Double
401.
402. If deltaHeight2 > deltaWidth2 Then
403. 'Scale by the height
404. scaleFactor2 = maxHeight2 / imgHeight2
405. Else
406. 'Scale by the Width
407. scaleFactor2 = maxWidth2 / imgWidth2
408. End If
409.
410. imgWidth2 *= scaleFactor2
411. imgHeight2 *= scaleFactor2
412.
413. Else
414.
415. End If
416.
417.
418. Dim objThumbnail2 As System.Drawing.Bitmap = PictureInfoSmall.GetThumbnailImage(imgWidth2, imgHeight2, Nothing, System.IntPtr.Zero)
419.
420. '---------------supposed to fix -----------------------------------
421. Dim graphicsImage2 As Graphics
422. graphicsImage2 = Graphics.FromImage(objThumbnail2)
423. graphicsImage2.SmoothingMode = Drawing.Drawing2D.SmoothingMode.HighQuality
424. graphicsImage2.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
425. graphicsImage2.DrawImage(objThumbnail2, 0, 0, imgWidth2, imgHeight2)
426. '--------------------------------------------------------------------
427. graphicsImage2.Save()
428.
429. objThumbnail2.Save(Path2, Imaging.ImageFormat.Jpeg)
430.
431. graphicsImage2.Dispose()
432.
433.
434. e.NewValues("PictureThumb") = DataPath2
435.
436.
437. myStream.Close()
438. myStream.Dispose()
439.
440. PictureInfoSmall = Nothing
441. objThumbnail2 = Nothing
442.
443.
444.
445.
446.
447.
448.
449. End If
450.
451.
452. ElseIf Not FileUploadPicture.HasFile Then
453.
454. 'Dim PictureOld = CType(SuperFormAquariums.FindControl("HiddenFieldPictureEdit"), HiddenField).Value
455. 'Dim PictureThumbOld = CType(SuperFormAquariums.FindControl("HiddenFieldPictureThumbedit"), HiddenField).Value
456. 'Response.Write("new:" & e.NewValues("Picture") & " " & e.NewValues("PictureThumb") & " OLD: " & e.OldValues("Picture") & " " & e.OldValues("PictureThumb"))
457. 'Response.End()
458.
459. e.NewValues("Picture") = e.OldValues("Picture")
460.
461. e.NewValues("PictureThumb") = e.OldValues("PictureThumb")
462.
463. End If
464.
465.
466. End Sub
467.




any help would be appreciated

#2
TheWebGuy

TheWebGuy

    Newbie

  • Members
  • Pip
  • 7 posts
OK, found where the glitch is


 <obout:SuperForm ID="SuperFormPersonalInformation" runat="server" AutoGenerateEditButton="True" 

                                    DataKeyNames="UserAccountsID" AutoGenerateRows="False" Width="100%"  

                                        HorizontalAlign="Center" DataSourceID="ObjectDataSourcePersonalInfo" 

                                        BorderColor="#AEADAD" BorderStyle="Solid" BorderWidth="1px" 

                                        HeaderStyle-BorderColor="#AEADAD" HeaderStyle-BorderStyle="Solid" 

                                        HeaderStyle-BorderWidth="1" AllowDataKeysInsert="False" GridLines="Both">

                                    

                                    <Fields>

                                        <obout:BoundField DataField="NickName" HeaderText="NickName:" SortExpression="NickName" ControlStyle-Width="200" Required="False" ControlStyle-ForeColor="Red" />

                                        <obout:BoundField DataField="FirstName" HeaderText="First Name:" SortExpression="FirstName" ControlStyle-Width="300" Required="False" ControlStyle-ForeColor="Red" />

                                        <obout:BoundField DataField="LastName" HeaderText="Last Name:" SortExpression="LastName" ControlStyle-Width="300" Required="False" ControlStyle-ForeColor="Red" />

                                            <obout:TemplateField>

                                                <EditItemTemplate>

                                                    <br /><br />

                                                </EditItemTemplate>

                                            </obout:TemplateField>

                                          <obout:DropDownListField DisplayField="Gender" DataField="GenderID" DataTextField="Gender" DataValueField="GenderID"  HeaderText="Gender:"  ControlStyle-Width="200" Required="false" ControlStyle-ForeColor="Red" DataSourceID="ObjectDataSourceGender" />

                                              <obout:TemplateField>

                                                <EditItemTemplate>

                                                    <br /><br />

                                                </EditItemTemplate>

                                            </obout:TemplateField>

                                        <obout:BoundField DataField="Email" HeaderText="Email:" SortExpression="Email" ControlStyle-Width="200" Required="False" ControlStyle-ForeColor="Red" />

                                        <obout:TemplateField HeaderText="Phone:">

                                                <ItemTemplate>

                                                    <%# GetPhoneFormat(Eval("Phone"))%>

                                                </ItemTemplate>

                                               

                                                <EditItemTemplate>

                                                 <obout:OboutTextBox ID="TextBoxPhoneedit" runat="server" text=' <%# Bind("Phone")%>'/>

                                                

                                                </EditItemTemplate>

                                            </obout:TemplateField>

                                       

                                            <obout:TemplateField>

                                                <EditItemTemplate>

                                                    <br /><br />

                                                </EditItemTemplate>

                                            </obout:TemplateField>

                                         <obout:BoundField DataField="Address1" HeaderText="Address 1:" SortExpression="Address1" ControlStyle-Width="400" Required="False" ControlStyle-ForeColor="Red" />

                                         <obout:BoundField DataField="Address2" HeaderText="Address 2:" SortExpression="Address1" ControlStyle-Width="300" Required="False" ControlStyle-ForeColor="Red" />

                                         <obout:BoundField DataField="City" HeaderText="City:" SortExpression="City" ControlStyle-Width="200" Required="False" ControlStyle-ForeColor="Red" />

                                         <obout:DropDownListField DisplayField="State" DataField="StateID" DataTextField="State" DataValueField="StateID"  HeaderText="State:"  ControlStyle-Width="200" Required="false" ControlStyle-ForeColor="Red" DataSourceID="ObjectDataSourceStates" />

                                         <obout:BoundField DataField="PostalCode" HeaderText="PostalCode:" SortExpression="PostalCode" ControlStyle-Width="60" Required="False" ControlStyle-ForeColor="Red" />

                                         <obout:DropDownListField DisplayField="Country" DataField="CountryID" DataTextField="Country" DataValueField="CountryID"  HeaderText="Country:"  ControlStyle-Width="200" Required="false" ControlStyle-ForeColor="Red" DataSourceID="ObjectDataSourceCountries" />

                                         <obout:TemplateField>

            

             <HeaderTemplate>

               Profile Picture:

               </HeaderTemplate>

                <ItemTemplate>

                    <asp:Image ID="ImageAquariumPicture" runat="server" BorderColor="Black" BorderStyle="Solid" BorderWidth="1" imageurl='<%# GetPictureFormat(Container.DataItem("PictureThumb")) %>'/>

                  

                    <asp:HiddenField ID="HiddenFieldPictureThumb" runat="server" value='<%# Eval("PictureThumb") %>' />

                    <asp:HiddenField ID="HiddenFieldPicture" runat="server" value='<%# Eval("Picture") %>' />

               

                </ItemTemplate>

                <EditItemTemplate>

              <asp:HiddenField ID="HiddenFieldPictureThumbedit" runat="server" value='<%# bind("PictureThumb") %>' />

                    <asp:HiddenField ID="HiddenFieldPictureedit" runat="server" value='<%# bind("Picture") %>' />

                    <asp:FileUpload ID="FileUploadEditPicture" runat="server" width="400" />

                </EditItemTemplate>

                

            </obout:TemplateField>

                                    </Fields>

                                    </obout:SuperForm>

                                    

                                    <asp:ObjectDataSource ID="ObjectDataSourcePersonalInfo" runat="server" 

                                        SelectMethod="GetPersonalInformation" TypeName="DAL" 

                                        UpdateMethod="UpdatePersonalInformation">

                                        <SelectParameters>

                                            <asp:SessionParameter Name="UserAccountsID" SessionField="UserAccountsID" 

                                                Type="Int32" />

                                        </SelectParameters>

                                        <UpdateParameters>

                                            <asp:Parameter Name="UserAccountsID" Type="Int32" />

                                            <asp:Parameter Name="NickName" Type="String" />

                                            <asp:Parameter Name="FirstName" Type="String" />

                                            <asp:Parameter Name="Lastname" Type="String" />

                                            <asp:Parameter Name="GenderID" Type="Int32" />

                                            <asp:Parameter Name="Email" Type="String" />

                                            <asp:Parameter Name="Address1" Type="String" />

                                            <asp:Parameter Name="Address2" Type="String" />

                                            <asp:Parameter Name="city" Type="String" />

                                            <asp:Parameter Name="StateID" Type="Int32" />

                                            <asp:Parameter Name="PostalCode" Type="String" />

                                            <asp:Parameter Name="CountryID" Type="Int32" />

                                            <asp:Parameter Name="Phone" Type="String" />

                                            <asp:Parameter Name="Picture" Type="String" />

                                            <asp:Parameter Name="PictureThumb" Type="String" />

                                        </UpdateParameters>

                                    </asp:ObjectDataSource>



it's these two binds

<asp:HiddenField ID="HiddenFieldPictureThumbedit" runat="server" value='<%# bind("PictureThumb") %>' />
<asp:HiddenField ID="HiddenFieldPictureedit" runat="server" value='<%# bind("Picture") %>' />

lines 59 and 60
the question is, what's the work around
time to put on the thinking cap :)

but I'd think the dataset would close after it fills the formview

for some reason I need to bind those two so that I can do

e.NewValues("Picture") = e.OldValues("Picture")

e.NewValues("PictureThumb") = e.OldValues("PictureThumb")

on the itemupdating

#3
gokuajmes

gokuajmes

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 518 posts
Well a StreamReader, FileReader or some stream object has access to the file and has not been closed yet . This is the cause of your exception

#4
TheWebGuy

TheWebGuy

    Newbie

  • Members
  • Pip
  • 7 posts
Is t his not the correct way of doing it?

437. myStream.Close()
438. myStream.Dispose()

#5
gokuajmes

gokuajmes

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 518 posts
Yes you are right , that is the way to close it but disposing it in the finally block is recommended practice. Please debug the source code Line by Line to find the source of your problem. Report back with the line number and statement in that line




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users