Hi,
I have a winform that contains some controls in which some are mandatory fields and others are not. Now while inserting values into mysql db via forms I dont want to insert "some" values(which are not mandatory) of non mandatory fields .In order to that I know I can write like this: insert into tablename(col1,col2,col3,....)values(value1,value2,value3) But It is not mandatory that the user should fill all the values for fields which are not mandatory. How to get this??
for example assume there are 4 fields(which are not mandatory) namely sex,marital status,city,hobbies. Now user A fills sex,marital status,city but leaves hobbies field blank. User B fills marital status,hobbies,city and leaves sex field blank.
StevePosted Apr 11, 2009, 12:33 AM
look into Linq with Datasets...create custom classes with names that match the tables of your database, along with column names that match the columns in your table.
then use the DatContext() class to fill in the connection and then follow along with the Linq queries.
Niradhip ChakrabortyPosted Apr 9, 2009, 4:44 AM
You can make the non mandatory field as null in database. Now you can pass values to these fields or pass null values.