Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is it possible to determine if the dt has rows?
Message
De
11/05/2009 17:38:43
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01399235
Message ID:
01399247
Vues:
49
This message has been marked as a message which has helped to the initial question of the thread.
Naomi, I believe you want to look at Decimal.Parse and Int.Parse.

>Thanks a lot, this is going to work splendid, but now I'm getting this error
>
> _drItem.Price = (decimal)this.txtPrice.Text; // doesn't compile
>        _drItem.Qty = (int)this.txtQty.Text; //doesn't compile
>
>Error	4	Cannot convert type 'string' to 'int'	W:\sdc\SDCBarcodeScannerProject\SDCBarcodeScannerProject\SDCBarcodeScannerDeviceClient\OrdersEntryForm.cs	568	23	SDCBarcodeScannerDeviceClient
>
>
>>Hi,
>>
>>May be something like this:
>>
>>  // DataSet Orders = new DataSet();  // What ever DataSet that it is ...
>>  ...
>>
>>  bool isAnyRec = false;
>>  foreach (DataTable myDT in Orders.Tables)
>>      if (myDT.Rows.Count() > 0)
>>      {
>>          isAnyRec = true;
>>          break;
>>      }
>>
>>  ...
>>  if( !  isAnyRec )
>>      Orders.Tables["Details"].Rows.Add( myDataRow );
>>
>>
>>
>>> I want to be able to have my Add button to add a record into the Orders DS if I don't have a record there and then add record to the Details table.
>>
>>> My question is - how can I check if I already have records in Orders DS or not?
Very fitting: http://xkcd.com/386/
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform