SQL Server Error When trying to upload multiple files.

Last post 09-15-2010, 11:02 AM by BenSilverFox77. 5 replies.
Sort Posts: Previous Next
  •  09-14-2010, 1:43 PM 63999

    SQL Server Error When trying to upload multiple files.

    Hello,

    I am currently evaluating your product to determine whether or not I will purchase it for my company. I have set everything up correctly but continue to get this error "Cannot insert duplicate key row in object 'dbo.UploaderFiles' with unique index 'IX_Files_FileGuid" when I try to upload multiple files on my development station.
     
    I am running Windows 7 Ultimate, VS Studio 2010, framework 4. I also have SQL Server 2005 installed locally.
     
    Please help me to figure out the issue because I do like your product but wil not purchase unless I can resolve this issue.
     
    I have read and researched your website as well as others looking for the solution.
     
    BTW: I am just using the sample code from your demo. I have changed the appropriate connection string information already also. I am running the code from within a copy of the current production website and have moved all the required files into the website in the appropriate folders.
     
    Thanks,
     
    Ben
  •  09-14-2010, 2:42 PM 64004 in reply to 63999

    Re: SQL Server Error When trying to upload multiple files.

    Dear Ben,
     
    Please test your code several times, do you have this issue every time or intermittent? I tested it serveral times on my end, I cannot reproduce it.
    The FileGuid of every uploaded file has different value, it should not throw this duplicated key error. Can you check the column of "FileGuid"? Is there duplicate value?
    You can do the following:
    1. Go to your database and table
    2. Expand the table "UploaderFiles" and you will find Index
    3. Script out the index by right clicking on script index option
    4. Delete the index 

    Please test it again, keep us posted.
     
    Thank you for asking
  •  09-14-2010, 3:03 PM 64006 in reply to 64004

    Re: SQL Server Error When trying to upload multiple files.

    Good Afternoon Eric,
     
    I had tested my code at least a dozen times. I had even gone into the database and deleted all related records, rebuilt the indexes in all tables. I have deleted the index from table "UploaderFiles. This fixed the error dealing with the SQL Exception.
     
    It now appears to put duplicate entries or two records for every file into the database table "UploaderFiles" which are uploaded. I checked the temp file directory and there is only a single file, but now this problem needs to be solved.
     
    Thoughts on this? I have to say I am more comfortable with the thought of purchasing your software based on the support I am getting just for an evaluation.
     
    PLease let me know your thoughts as quickly as possible as I would like to get it purchased and implemeted into the production environment. I am under some time constraints here.
     
    Thanks,
    Ben
     
  •  09-14-2010, 3:26 PM 64008 in reply to 64006

    Re: SQL Server Error When trying to upload multiple files.

    Dear Ben,
     
    Can you send your code and sql script to [email protected]? I will check it.
     
    Thank you for asking
     
     
  •  09-15-2010, 7:23 AM 64025 in reply to 64008

    Re: SQL Server Error When trying to upload multiple files.

    Hi Eric,
     
    The code I am using is the code from your AdvancedVB20 sample directory. I copied the following files into the App_Code folder of my website, FileItem.vb, SampleDB.vb, SampleDB_Instance.vb and SampleUtil.vb.
     
    The SQL script I ran was the InstallSamples.sql from the App_Data directory. I copied and pasted the code from Ajax-based-File-storage.aspx file into a new aspx screen.
     
    The images from your directory were also copied into the website. So the code is still separate from the rest of the code of the website. The VB code was put into a code behind file which should make no difference. I changed the name of the DBConnection string to the required one in SampleDB.vb file.
     
    So all of the code is still standalone but within the website.
     
    I should also mention the test aspx screen is a content holder as I use Master Pages. But there is no script which would interfere with the code from this screen.
     
    I do not see the purpose of sending the code.
     
    Please advise.
     
    Thanks,
     
    Ben 
     
    PS: It appears as if the event which inserts the record into the SQL table is firing twice. I have gone back in and made sure all of the required files and the web.config contains all referemces required for the system.
  •  09-15-2010, 11:02 AM 64030 in reply to 64008

    Re: SQL Server Error When trying to upload multiple files.

    /****** Object: Index [IX_Files_FileGuid] Script Date: 09/15/2010 08:45:21 ******/

    Hi Eric,
     
    I finally was able to get the system to work. The issue was within the Index itself. The scripts are below. I made one change and then everything was working correctly. I just thought I would let you know.
    IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[UploaderFiles]') AND name = N'IX_Files_FileGuid')

    DROP INDEX [IX_Files_FileGuid] ON [dbo].[UploaderFiles] WITH ( ONLINE = OFF )

    GO

    --/****** Object: Index [IX_Files_FileGuid] Script Date: 09/15/2010 08:45:21 ******/

    --CREATE UNIQUE NONCLUSTERED INDEX [IX_Files_FileGuid] ON [dbo].[UploaderFiles]

    --(

    -- [FileGuid] ASC

    --)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

    --GO

    /****** Object: Index [IX_Files_FileGuid] Script Date: 09/15/2010 08:45:21 ******/

    CREATE UNIQUE NONCLUSTERED INDEX [IX_Files_FileGuid] ON [dbo].[UploaderFiles]

    (

    [FileGuid] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = ON, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

    GO

View as RSS news feed in XML