Farhan Ghumra
Farhan Ghumra

Reputation: 15296

MobileServiceInvalidOperationException 500 - Internal server error while inserting into table

I want to make a sample app of uploading blob to azure storage. I have followed this and this, both the way throws me MobileServiceInvalidOperationException 500 - Internal server error. Please give me solution ASAP. Thanks.

Here is error log

Error inserting: { AlbumId: 22,
Name: 'ff',
Description: 'ff', ThumbnailUrl: null,
ThumbnailFileName: '73a594b1-1abb-476d-a1ce-73a12d6ee278_thumbnail.png', ImageUrl: null, FileName: '73a594b1-1abb-476d-a1ce-73a12d6ee278.png', imageurl: 'https://xxxxxxx.blob.core.windows.net/mypictures-undefined/undefined?se=2013-02-07T10%3A44%3A57Z&sr=b&sp=w&sig=qDBnnVOyo8XCNSUNJcn49IMcN4laDIgjZ8oM9TdiHBI%3D', thumbnailurl: 'https://xxxxxxx.blob.core.windows.net/mypictures-undefined/undefined?se=2013-02-07T10%3A44%3A57Z&sr=b&sp=w&sig=qDBnnVOyo8XCNSUNJcn49IMcN4laDIgjZ8oM9TdiHBI%3D' }
{
[Error: [Microsoft][SQL Server Native Client 10.0][SQL Server]The column name 'ImageUrl' is specified more than once in the SET clause or column list of an INSERT. A column cannot be assigned more than one value in the same clause. Modify the clause to make sure that a column is updated only once. If this statement updates or inserts columns into a view, column aliasing can conceal the duplication in your code.] sqlstate: '42000', code: 264
}

Upvotes: 1

Views: 600

Answers (2)

Farhan Ghumra
Farhan Ghumra

Reputation: 15296

I have solved the problem with the reference of this article. One advice from me, if you want a demo of uploading blob to Azure please visit that link don't waste your time in MSDN sample.

Upvotes: 0

Jim O'Neil
Jim O'Neil

Reputation: 23754

You've got two properties on the same (JavaScript) object that differ by case, but the Windows Azure SQL Database instance behind it isn't case-sensitive when it comes to column names.

It seems your C# class includes a property named ImageUrl (note case), then in the Insert script for your table (per the reference you quoted), you're doing item.imageurl in all lower case.

You could add the DataMember attribute to your C# property and you'd be ok, I suspect.

[DataMember(Name = "imageurl")]
public String ImageUrl { get; set; }

Same for ThumbnailUrl

Upvotes: 5

Related Questions