Wednesday, March 7, 2012

DeleteCommand and UpdateCommand

I have added a gridview and under its properties i have changed AutoGenerateDeleteButton and AutoGenerateEditButton to true.

The problem is... when I try and delete a record, I get this error: Deleting is not supported by data source 'SqlDataSource1' unless DeleteCommand is specified

If I try and update.. i get the error: Updating is not supported by data source 'SqlDataSource1' unless UpdateCommand is specified.

Can someone please help me out... maybe with some code... or a link to a tutorial..

Thanks

Canning

When you configure your datasource, you need to choose "Advanced". On the Advanced page, you need to check "Generate Insert,Update and Delete commands". This will generate attributes in your sqldatasource that allow for these things to happen. Make sure you have a primary key in your table set.|||

Hi,

I have the same problem. I tried to change the advanced setting as you specified. However, it is not allowing me to do so. The check boxes are greyed out.

Any suggestions?

thanks..

|||Greyed out usually means there is no primary key on the table that the control can recognize.|||

Also,

I do see where it says on the advanced section that "You must have all primary key fields selected for this option to be enabled." Im not sure what that means though. I have every column in the table selected to display. That does not help though. Can you tell me where I find the primary key fields so that I can "Select" them?

thanks...

|||

I do see where it says on the advanced section that "You must have all primary key fields selected for this option to be enabled." Im not sure what that means though. I have every column in the table selected to display. That does not help though. Can you tell me where I find the primary key fields so that I can "Select" them?

thanks...

|||

I was able to figure this out...thanks...and sorry for posting that twice.

Thanks for the direction.

|||

Hi,

I have the same problem that DavidatWork. Can you send me the direction too?

|||I have the same problem however in my table I specify a primary key. I still have the options disabled. Any help?|||

WEN I tried to change the advanced setting OPTION However, it is not allowing TO DO THAT The check boxes ARE UNCHECKED IE GREYED OUT SO HOW CAN I DO UPDATE AND DELETE IN MY TABLE.hOW TO ADD PRIMARY KEY ON THE TABLE

|||

hoW TO ADD PRIMARY KEY IN TABLE QUERY I HAVENT FOUND ANY OPTION REGD PRIMARY KEY CAN U SUGGEST ME

tHANK U

bHANUPRIYA

|||

do this:

ALTER TABLE Customer ADD PRIMARY KEY (SID);

(it's not the same as having an identity column).

|||

i have the same problem can anyone tell me how to resolve it?

No comments:

Post a Comment