I am getting this error.
I wrote code to save multiple Images...now when I save all the 4 image I get no exception...
but when I try to save only 1 or 2 or 3 its throws an exception Empty Path is not legal.
Please post your code. The exception is clear about what the issue is, so you need to look into why the path you're trying to save is interpreted as being empty. Most likely it's getting cleared somewhere.
You can't open an empty location with your FileStream.
You could guard with String.IsNullOrEmpty before you try and load anything.
What you should do is redesign this. All of the work you're doing can be done with a single method over multiple iterations, or, by passing the parameters into an array and passing that to the database methods.
So you could have one method called byte GetImageBytes(string filePath) which would load the image up. This way you could call it from a loop, or, individually if you had to.
Finally, you should never, ever, ever build up a query string like that.
You could quite easily write a small script into any of the textboxes that will cause your script to drop your customer table and ignore everything else afterwards. you're already using parameters for your images, so I don't know why you didn't for everything else too.
First of all thank you very much...
u wre right
this is what I did and my problem is solved
string picLoc = @"d:\Pc Configure\Pc Configure\Resources\stopgate1.png";
string picLoc1 = @"d:\Pc Configure\Pc Configure\Resources\stopgate1.png";
string picloc2 = @"d:\Pc Configure\Pc Configure\Resources\stopgate1.png";
string picloc3 = @"d:\Pc Configure\Pc Configure\Resources\stopgate1.png";
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...