Last post Feb 14, 2009 10:17 AM by darkknight187
Feb 10, 2009 10:03 PM|nimish|LINK
I upload pictures to the default upload folder at web root. But when I see the contents - I only see image files by the name 0. like 0.Lg.jpg, 0.Md.jpg, 0.Sm.jpg. Then when I upload another image, it would overwrite existing 0 files. So in other words
I see only 0 files.. just 3 files.
When I debug this issue, found that in photo.cs file, the db.insertphoto always returns photoid= 0. This is coming from the dataadapter. When I run the method manually from the ads.xsd, it returns the correct photoid. The stored procedure also returns correct
value. For some reasons, Line 13 always returns 0.
Can anyone help?
public static int InsertPhoto(int adId, byte bytesFull, byte bytesMedium, byte bytesSmall, bool useAsPreview)
int photoId = -1;
if (bytesFull != null && bytesMedium != null && bytesSmall != null)
SiteSettings s = SiteSettings.GetSharedSettings();
using (PhotosDataAdapter db = new PhotosDataAdapter())
photoId = Convert.ToInt32(db.InsertPhoto(adId, bytesFull, bytesMedium, bytesSmall, useAsPreview, DateTime.Now));
photoId = Convert.ToInt32(db.InsertPhoto(adId, null, null, null, useAsPreview, DateTime.Now));
string fullSizePath = GetFilePath(photoId, false, PhotoSize.Full);
string mediumSizePath = GetFilePath(photoId, false, PhotoSize.Medium);
string smallSizePath = GetFilePath(photoId, false, PhotoSize.Small);
Feb 12, 2009 11:49 PM|darkknight187|LINK
The problem is that you are using the beta version of the classifieds kit instead of the final version.
The problem lies in your stored procedure InsertPhoto
Not the public static you have above.
Open the InsertPhoto Stored Procedure and I forget what it says in your version.
But the issue is at the end of it.
If it doesn't work paste your stored procedure.
Feb 13, 2009 08:29 PM|nimish|LINK
I downloaded the kit from asp.net starter kit section. If I run the method in dataset, it returns correct value.
Below is SP my code-
ALTER PROCEDURE InsertPhoto
@BytesFull image = NULL,
@BytesMedium image = NULL,
@BytesSmall image = NULL,
@IsMainPreview bit = 0,
@DateCreated smalldatetime = getdate
DECLARE @Id int;
(AdId, BytesFull, BytesMedium, BytesSmall, IsMainPreview, DateCreated)
(@AdId, @BytesFull, @BytesMedium, @BytesSmall, @IsMainPreview, @DateCreated)
SET @Id = @@IDENTITY;
IF @IsMainPreview = 1
UPDATE Ads SET PreviewImageId = @Id WHERE Id = @AdId
Feb 13, 2009 10:10 PM|darkknight187|LINK
I have been using the kit for a long time, it's the beta you have.
Something must of happened to Microsoft's version and they removed the final.
And then the only available download was beta.
Anyway, replace line 19 "Return @Id" with
SELECT @Id AS
It will work.
Feb 14, 2009 09:21 AM|nimish|LINK
Ok I will try that but now I am thinking maybe there are more issues that I am not aware.
Where can I get final or latest copy? Link can be helpful.
Thanks for your help, really appreciate it.
Feb 14, 2009 10:17 AM|darkknight187|LINK
I don't think their is a link.
I still have the final class.vsi
Send me a private message with your email address, and I will send it to you.