Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding a record to a dataset
Message
 
À
10/01/2005 17:08:53
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
00975570
Message ID:
00976048
Vues:
15
Hi Bonnie.

Since I wrote the last email, I did think of one concrete example.
(This could happen in say VFP (if uisng it a the back end) or any other system.

If using Numeric fields and say you are adding a column of data , some with numeric fields and some with null fields, in your experience does this cause any problem. If the null fields 'defaults' to a zero. I suppose everything should be ok.. just curious on your own experiences with other backlend dtabases (e,g, Sql nSrver,Access, et al)

Regards,

Gerard


>Hi Gerard,
>
>Boolean null columns are only a pain because the checkbox control doesn't handle a null very elegantly. So, you have to have a checkbox subclass that'll handle that. But for all other data types with other types of controls (like TextBox), a null is not usually a problem.
>
>>>Also, I have it in the back of my mind that null values cuse problems with some third party pieces of software, e.g. report writers , which expect fields to be Non Null....<
>
>Hmmm ... could be I suppose ... we haven't been using much in the way of third party stuff. But if they don't handle nulls correctly, then shame on them!! <g>
>
>>>As a matter of interest, when you add a record, if a user does not go near a field, do you normally leave that field as Null in your Apps ?<
>
>Yep!
>
>~~Bonnie
>
>
>
>>Hi Bonnie.
>>
>>Do 'Null' fields not cause a problem is displaying on a screen , for, instance , where you may have to take 'evasive ' action.
>>
>>One area springs to mind is that , say on a Logical field (Sorry Boolean in DotNet speak), is that when you add a new record say, you expect a field to be false, but if it is 'null' you have to amke it false.
>>
>>Also, wont you always have to continually check for 3 states... null, True or false..... in 99 % of cases true or false suffices, and just in the interest of keeping it simple, the least options there are , the better
>>... thats my feelings on it but I am open to suggestion.
>>
>>
>>Also, I have it in the back of my mind that null values cuse problems with some third party pieces of software, e.g. report writers , which expect fields to be Non Null....
>>
>>
>>As a matter of interest, when you add a record, if a user does not go near a field, do you normally leave that field as Null in your Apps ?
>>
>>
>>
>>regards.
>>
>>Gerard
>>
>>
>>
>>>>>I would have a preference for 'Blank' fields rather than 'Null' fields but maybe ny prference is musguided in the Dot Net scenario... I dont Know .<
>>>
>>>Well, Gerard ... there's nothing wrong with null fields. I remember when I first started with .NET being a bit dismayed by that as well, but, if you think about it, null makes more sense than a blank or a zero, because null means data has never been entered. It just takes some getting to used to.
>>>
>>>~~Bonnie
>>>
>>>
>>>>Hi Magnus.
>>>>
>>>>Yes.. I was thinking along those lines .. just thought something might ave already been there.
>>>>
>>>>I wonder what other folk here do.. I've never had the problem upto now as I've alwayd developed in VFP and tended to use App Blank or similar, which automatically blanks the fields.
>>>>
>>>>I would have a preference for 'Blank' fields rather than 'Null' fields but maybe ny prference is musguided in the Dot Net scenario... I dont Know .
>>>>
>>>>Regards,
>>>>
>>>>Gerard
>>>>
>>>>
>>>>
>>>>>Hi Gerard,
>>>>>
>>>>>If you loop through the column collection and make sure you cover all the types there would not be any problem if you add a column later on.
>>>>>
>>>>>Why not write a little class file that takes a datarow as a param byref and initializes it with 'blank' data? Just a suggestion.
>>>>>
>>>>>>Hi Kevin.. thanks for your reply
>>>>>>I suspected something like that would have to be done and was just 'hoping' there would have been an easier /shorter way to do it.
>>>>>>
>>>>>>The problem with this is that
>>>>>>1) You have to cycle through each field and initialise it
>>>>>>2) You have to test on the 'type' of eacj field if its to be done generically
>>>>>>3) 2 Years on when you add an extra field to the table, it means having to
>>>>>> go through each piece of code (in evry file in the APP and checking where you have 'added' a record
>>>>>>
>>>>>>.... Appe Blank was just so easy.... it did it all for you !!
>>>>>>
>>>>>>
>>>>>>Regards
>>>>>>Gerard
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Just as a follow-up, you can also do this...
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>DataRow DrNewRow = myTable.NewRow();
>>>>>>>DrNewRow["firstname"] = ""
>>>>>>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform