working with sql inserting type double, string, int - How to detect unasigned value.

Hi there

i am try to work with data type
double, int, enum, string in and create a function to insert/select from mysql

i have issue when to create this function i have no way to know if the value should be insert to sql or not because i dont know if it unassigned or or assigned.

the idea is that if i know the value is unassigned then i will not generate TSQL to insert into SQL and so database will not insert incorrect value such as 0 or "".

On the other hand, when pull the data from SQL i need to know that these value is not assigned so i can display on application as not available... instead of showing 0 or something that has incorrect meaning...

Who is Participating?
CodeCruiserConnect With a Mentor Commented:
Show us the code in the function. May be you want to use NullAble(of T) as types of members in the class and then use .HasValue to find out if the member has been assigned a value.
JSW21Author Commented:
To explain a bit more:
When I assigned no data as 0 for an enum type i can filter the zero out during TSQL insertion but it will be wrong b/c data can be 0....

My older application i assigned value like -987654321 to id the non assigned value but it get bulky.
and it would slow thing down.
Some more explanation please(outside of assigned/unassigned).
JSW21Author Commented:

Say I want to update field columns in SQL with .. x y z .... My function does not know which  x y z is a new data... x y z are members in a class obj.

because If know which is not updated then I would exclude it from TSQL
The question is how do I identify if any member in this class has some value assigned to it.

for instance if class is a stock data ... some stock has volume field , and another doest have volume field ... sort of speak. but Volume can be 0.

JSW21Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.