John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Network:
Windows 2003 Server
>>>Hi everybody,
>>>
>>>Is there a simple way to check if the dataset is empty? I have a button to copy ds to Excel. However, I want to show some message if ds doesn't have records. Should I get the DataTable first and check RowCount?
>>>
>>>Thanks in advance.
>>
>>
>>if( ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
>>{
>> do something here;
>>}
>
>Thanks a lot.
>
>May I ask you a more complex question?
>
>We're setting GridView dataset in code. Originally it was defined in the page in SQLDataSource and the Delete worked by itself using DeleteCommand of SQLDataSource.
>
>Now I'm not sure how can I handle it. Do you know if there is a way to somehow specify DeleteCommand for DataSet?
I'm not sure I understand what you are asking. When a row is deleted in the grid, if the dataset is being used as its datasource, the row is marked for deletion in the datastate (rowstate = RowState.Deleted). When you pass the dataset back for update through a table adapter or a sql update command, the row is automatically deleted from sql server.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement