473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Empty fields in databinding

Hi

I have date/time fields in database access table and i would like to be
able to have the choice to be empty when i click the submit button in
my vb.net form.

In the click event of the submit button i have the following code:
Me.comInsertIC.Parameters("expirydatecoke05lpet"). Value =
Me.txtexpirydatecoke05lpet.Text

comInsertIC is the insert command generated by the adapter.

When I click submit button and the field is an empty string I get the
following exception: String was not recognised as a valid datetime.

What can I do in the case of adding a new record and editing an
existing one?
(I use the comInsertIC for adding and for editing the following code:
Me.BindingContext(Me.datasetAddEditIC.ic).EndCurre ntEdit()
Me.adapter.AddEditIC.Update(Me.datasetAddEditIC.ic )

Thank you
Savvas

Nov 22 '05 #1
4 1164
Savvas,

Is the expirydatecoke05lpet a real datetime field on your database server?

Than you need at least CDate(Me.txtexpirydatecoke05lpet.Text)

I hope this helps so far,

Cor

Nov 22 '05 #2
Hi Cor,
The expirydatecoke05lpet is a datetime field in my database. I have
tried the above but it throws an invalid cast exception.

I still can't enter an empty string.

Thanks again
Savvas

Nov 22 '05 #3
Savvas,

Have a look in this sample for the use of OleDb parameters.

To set a dbvalue to dbnull you can try "Nothing"

I hope this helps,

Cor
Nov 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Savvas | last post by:
Hi I have date/time fields in database access table and i would like to be able to have the choice to be empty when i click the submit button in my vb.net form. In the click event of the...
5
by: Krechting | last post by:
Hi ALl, I have a code that checks if the documents in a hyperlink field are still where they should be. I use fileexist(). First I want to filter out all the hyperlink fields that are empty. I...
1
by: Reza | last post by:
Hi I have a column in my datagrid that can have values of null at times. I am not assigning any value to it, if it is coming from Database empty. Now, the problem is I guess the datetime variables...
2
by: Anders K. Jacobsen [DK] | last post by:
Im developing an ASP.NET application. So far im pretty pleased. Databinding is really nice but also gives me som e problems / design issues. Lets say I want to bind a list of contries to a...
1
by: novato | last post by:
Hello, this is my first post, I´m new in C# and i´m developing a capture for a test helth for babies (tamiz), I´m making a capture screen with text box and checkbox. For databinding textbox I don´t...
0
by: novato | last post by:
Hello, this is my first post, I´m new in C# and i´m developing a capture for a test helth for babies (tamiz), I´m making a capture screen with text box and checkbox. For databinding textbox I don´t...
1
by: Anilsg | last post by:
Hi all, I have the DropDownList in the FormView,inside InsertTemplateField The data is binded in run time to it in codebehind page,FOr the First time the page is loaded the DropdownList is...
0
by: Anilsg | last post by:
Hi all, I have the DropDownList in the FormView,inside InsertTemplateField The data is binded in run time to it in codebehind page,FOr the First time the page is loaded the DropdownList...
8
by: Wingot | last post by:
Hey, I have a program I am trying to write using Visual C#, SQL Server 2005/2008, and Visual Studio 2008, and one part of it includes a Schema called Client. Inside this schema, three tables...
2
by: Nathan Sokalski | last post by:
I have a Repeater that uses a DataSource that has multiple fields. When the values of these fields is displayed in the Repeater, there are fields that are used in combination with other fields as...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.