Wednesday, March 7, 2012

Problem with Deletecomand attribute of asp:sqldatasource

Greetings everyone. I'm trying to set up a GridView that makes use of an SQL Datasource. All commands (update,select,delete) are set within the tag's attributes but when i hit the Delete Trigger it returns that the id variable is undeclared.

<asp:SqlDataSource
ID="KevinDataSource"
ConnectionString="Server=overmind;Database=kevin_bonis;User=sa;Password="
SelectCommand="SELECT * FROM Accesorii"
UpdateCommand="Update Accesorii SET nume_accesoriu=@.nume_accesoriu,
articol=@.articol,
cantitate=@.cantitate,
trimis_bolla=@.trimis_bolla,
bolla=@.bolla,
data_trimitere=@.data_trimitere,
intors=@.intors,
data_intoarcere=@.data_intoarcere WHERE id=@.id"
DeleteCommand="DELETE FROM Accesorii WHERE id = @.id"
runat="server" /
What could be the problem with this? I'll appreciate any help i can get.
Thanks alot, Allyrion

Hi Allyrion,

did you set the datakeynames property for Gridview?

Lan

No comments:

Post a Comment