farshad Posted February 18, 2004 Posted February 18, 2004 Hi, My question is to do with the datatype? In the constructor of a class, I am initializing the variables which are of various types (i.e: string, double, decimal, etc...) These are initialized such as "" for string and 0 for int or 0 for double, etc... Let's say that during a call to the DB, only one of them gets set (i.e: the string variable = "hello") but the other variables are not set. So obviously the other variables are set to 0 of they are decimal for example. The question is that how is it possible to find out that the other variables that were not set?. I.e: how can I return null for the other variables? Hope this is clear Thanks Quote Farshad
I Schobert Posted February 18, 2004 Posted February 18, 2004 I am not quiet sure that I understand your question. What I get is that you wish to have variables that return only values when they are assigned, and otherwise Null. How about if you don't assign a default value to them and declare them at the beginning of the class, like: Private myVariable as String Private myOtherVar as Double Now, in case of a db call, only assign values to the ones that do not have a dbNull return (test for "Not IsDbNull"). All other variables should have a value of Nothing at this point. Does that help? Quote IS
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.