Question What approach for passing null value to date field?

adshocker

Well-known member
Joined
Jun 30, 2007
Messages
180
Programming Experience
Beginner
hi all,

i'm not 100% sure about sql server but i think it doesn't accept null value for date type columns but in oracle, a date column can accept a null value.

and since i'm using oracle, this is causing some problems because in my form, a textbox item bound to a date column will not accept a null value.

reading thru some threads, it would seem that it is not possible to pass a null value to a date type in .Net.

what approach can i do to go around this?

thanks.
 
Last edited:
hi,

just wanted to ask..

i use the Visual Basic 2005 Express Edition.. can i use the approach suggested?

thanks.
VB Express will create Data Sources and generate typed DataSets, but it only works with SQL Server and Access, not Oracle. Of course, you could always just build a typed DataSet yourself and then use OracleDataAdapters instead of auto-generated TableAdapters.
 
hi,

actually that's what i have right.. but what i meant was using the sample given by cjard. one of the files was the dataset.Designer.vb. and it looks a lot different of course since he's using a different version of VS. but if i wanted to follow the dataset.Designer.vb that he provided, won't i be needing to edit my dataset.Designer.vb probably using partial class as suggested by jmcilhinney?

thanks.
 
hi,

just wanted to ask..

i use the Visual Basic 2005 Express Edition.. can i use the approach suggested?

thanks.

What I was advocating you do, actually, is read the code I provided; VS made it and yes, you can just drop it straight into your app and it will work (You'll need to add the connection strings to your settings) - it uses all standard Microsoft components that exist in the framework (System.Data.Oracle*), but actually you can use it to gain knowledge of how the dataset designer would write queries for Oracle databases and assign values to parameters etc.. Then you can consider writing your own app or SQL views that will effectively write code for you to access oracle databases. A guy I know uses the 2 views I provided to you, and Visual WebDev Express to do all his work with Oracle.

That said, you may also feel that Visual Studio is a good investment if it saves you a lot of work..

You can always write code to help you write code; have a play with command builder too - you could write a simple program where you pass in a select, and then have it generate commands for you to paste in/use as a starting point for your own customizations, all using the command builder
 
it looks a lot different of course since he's using a different version of VS
Different to what?

but if i wanted to follow the dataset.Designer.vb that he provided, won't i be needing to edit my dataset.Designer.vb probably using partial class as suggested by jmcilhinney?
You can't possibly have a dataset.Designer.vb from an Oracle database, because VB Express won't link to an oracle db.. so I'm not sure what youre talking about here..
 
You can't possibly have a dataset.Designer.vb from an Oracle database, because VB Express won't link to an oracle db..

hi,

yes, you are right about this... i added the dataset manually and created the datatables manually. then when i check i dataset.Designer.vb, naturally it looks different than the one you provided considering yours was done automatically by the wizard.

so I'm not sure what youre talking about here..

i was trying to find a way so that i can apply the same logic but since i can't edit my dataset.Designer.vb to have all the Update function etc.,, i was thinking of creating a partial class, imports the System.Data.OracleClient, then i manually create oracledataadapters, oraclecommands, create the Update function similar to the example you had etc.. since my current dataset.Designer.vb does not have all these objects.

although, im not sure if this is possible. or is this not a good way to go?

thanks.
 
Last edited:
i was trying to find a way so that i can apply the same logic but since i can't edit my dataset.Designer.vb to have all the Update function etc.,, i was thinking of creating a partial class, imports the System.Data.OracleClient, then i manually create oracledataadapters, oraclecommands, create the Update function similar to the example you had etc.. since my current dataset.Designer.vb does not have all these objects.
I think youre making more of a big deal out of it than it actually is; The designer wizard simply creates code that can be compiled by ANY vb compiler. There is no crippling of the Express VBC that makes it incapable of compiling the code I generated. TableAdapters go in a separate namespace, and there is nothing stopping you taking my dataset.Designer.vb file, renaming it, and adding it to your project as a class and just using it. Similarly, there is nothing stopping you analysing the file, and writing a program to create all the same code from a known oracle table definition (essentially you write yourself the missing part of your VB Express, namely the Dataset Designer modules that connect to oracle)

You won't succeed, i think, in shoeing the code I genned into your project in such a way that the dataset designer allows you to edit the tableadapter properties, but it is not a problem, because the xml files that define the dataset are not needed in the compilation; they merely instruct the dataset generator how to make the dataset.Designer.vb file that has all the code for the tableadapters.

Weigh up what it would cost you to create a bit of software that connects your oracle to your app; i.e. your app would link to oracle, download a table definition, create tableadapter code like the example, create dataset xml like the example and bam; you'd have a data access layer in your vb express, implemented as a couple of classes you simply add to your project

although, im not sure if this is possible. or is this not a good way to go?

thanks.
personally, I'd put my hand in my pocket and buy VS; you might be able to get an old copy of 2003 cheap and buy the upgrade (possibly also cheap) or a cheap copy of 2005 now that 2008 is out.. Have a look around. If you don't put a high value on your time, then maybe it would be more cost effective taking a weekend out to write your own oracle data access layer creator..
 
i didn't know that i can take and use the dataset you provided in my express edition.

i had the assumption that vb express won't be able to use it since it auto-generates the code and remove any manual entries i make everytime i save it... my bad.

thanks for the tip :D
 
i didn't know that i can take and use the dataset you provided in my express edition.

i had the assumption that vb express won't be able to use it since it auto-generates the code and remove any manual entries i make everytime i save it... my bad.

thanks for the tip :D

The dataset.Designer.vb you have been given was auto generated by a tool. If you rename it and add it into your project as a file with a different name, the generator won't go looking for it so it can overwrite it, it would just make a new one (with dataset.Designer.vb as the name) which would overwrite any existing file. Are you starting to see how it works?

Edit the dataset, save it, the generator remakes the code.. But if you pull the code out of the way..
 
Back
Top