1
Answer

saving image problem

Photo of anil john

anil john

12y
859
1


My code:


 FileStream fs = new FileStream(fname , FileMode.Open); // this line generates error

                byte[] data = new byte[fs.Length];

                fs.Read(data, 0, Convert.ToInt32(fs.Length));

                objItemMasterBL.Sticker = data;


Error:

The process cannot access the file 'C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg' because it is being used by another process.

Answers (1)

0
Photo of Cassie Mod
NA 631 21k 9y
I think the problem lies in your queries. ( i don't know if they work i gues not).
 
use the following examples:
 
example innerjoin: 
var innerJoinQuery =
from category in categories
join prod in products on category.ID equals prod.CategoryID
select new { ProductName = prod.Name, Category = category.Name }; //produces flat sequence 
 
example groupjoin:
var innerGroupJoinQuery =
from category in categories
join prod in products on category.ID equals prod.CategoryID into prodGroup
select new { CategoryName = category.Name, Products = prodGroup };
 
or
 
var innerGroupJoinQuery2 =
from category in categories
join prod in products on category.ID equals prod.CategoryID into prodGroup
from prod2 in prodGroup
where prod2.UnitPrice > 2.50M select prod2; 
 
example left outer join:
var leftOuterJoinQuery =
from category in categories
join prod in products on category.ID equals prod.CategoryID into prodGroup
from item in prodGroup.DefaultIfEmpty(new Product { Name = String.Empty, CategoryID = 0 })
select new { CatName = category.Name, ProdName = item.Name };
 
The problem wich i had to face was that i was trying tu update 2 tables during a joing. But that wasn't possible. so i had to write 2 single update queries one for the first table and one for the second table. Offcourse you can add paramethers.
Hope this helps.
 
Kind regards