DATE field problem

Folks

I m trying to check the DATE field validation. I am trying to update this date field value in the
database and before that I have to check the validity. If there is a date value then format
it in the form and if it is not there add an empty string or add null value. I m adding the update statement also for ur ref.

If IsDate(DOB.Text) Then
DOB.Text = Format(DOB.Text, "MM/dd/yyyy")
Else
DOB.Text = " "
End If

strSQL = " UPDATE Persons "
strSQL += " set lngSSN ='" & SSN.Text & "',"
strSQL += " datBirth= '" & DOB.Text & "' "
strSQL += " WHERE lngPersonID = 503365 "
The errors are
I m getting a default value 1/1/1900 in SQL Server instead of the date I entered. If I donn enter any value then I am gettiing the below information
"Syntax error converting datetime from character string. ". I m kinda novice to the asp
so plz tell me how to validate date.

Tks
0
kir441
6/17/2004 4:06:39 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

1 Replies
419 Views

Similar Articles

[PageSpeed] 6

Check out the way the null value is entered in database 

Use the similar technique for update
Sushila Bowalekar Patel
Visual ASP/ASP.NET MVP
http://weblogs.asp.net/sushilasb
0
SushilaSB
6/17/2004 4:36:08 PM
Reply:

Similar Artilces:

Submitting Web forms fields to sql database by clicking on SUBMIT FORM and sending the form fields to email box
I have a created or designed a form to be stored in a SQL database table and at the same time when a user clicks on SUBMIT button the form fields will automatically goto the visitor email address immediately. Also i have created a database with tables for each of this forms Pls help i have over 10 forms designed but the problem of submitting them to the table database and the user email address is the challenge now.... You ned to familiarise yourself with the basics of database access in ASP.NET.  There are free tutuorials here: http://quickstarts.asp.net/QuickStartv20/aspnet/doc/da...

Open web page in IE and populate fields on the form from my web form
To the dot net Knights.  Many humble thanks in advance from a dot net surf. We have an vb application that opens multiple instances of IE object, each to different web pages.  It then takes information from the current record in the app, populates fields on each of the web pages, and them submits the forms.  We are then able to look at the resulting web pages and quickly get the info we're looking for.This prevents us from having to manually navigate to each web site, enter the same information and then wait for the page to open.  If there is ...

Implementing .Net Form into an APS.net web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an ASP.net web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

Problems with the .NET 2005 web form designer
In Visual Studio.NET 2003, building a web page was very similar to building a plain old form. In 2005, everything's changed. Every control gets shifted to the top left, I have to use panels and so on to separate things, and if I have to change something later it's an absolute nightmare. Am I really stuck with this, or is there some switch somewhere that will allow me to do things the way I'm used to?   Geoffrey Callaghan Try this.  Bring up an aspx page in design (not source) mode.  This will enable the Layout menu. Goto Layout->Position->Auto-Pos...

vs.net web forms wysiwyg resize row problem
I don't know if someone ever when throw this problem, but something weird is happening with the wysiwyg from web forms of .net, the problem is the following: sometimes when i'm selecting a control in the HTML mode it selects to resize the row by mistake, the resize mouse pointer appears and i click to drop the resize mode, but then i'm not allowed to go outside of the table that i resized the row even dropping the resize mode, i try to change to code mode, and it allows to go beond the table but when i get cack to HTML mode it doesm't i'm forced to restart the vs.net, this is quite anoyng...

After adding a date field in a web form update gives error
Hi I have a web form which is a part of asp.net application. This process updates a row of a table. This works fine. However, I needed to update a DueDate field. So I added the DueDate field in the form and changed the stored procedure and the corresponding code in asp.net. Now the update does not work. I am getting the following error message: @poduedate is not a parameter for procedure prr_out_projsearch_update1.  The following is the code for stored procedure: alter proc prr_out_projsearch_update1 @prr_id int,@changes_required bit,@NeedUpdate bit = 1,@datecompleted datetime ...

CR 9 for VS.NET PDF problems using web forms
Hi all. I am trying to capture patient history data then summarize the data in a one page report using Crystal Report. I would like to use Adobe Plug-in to alllow for printing the report (although printing from the browser will be acceptable). I am using the code straight off of the web site: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim myExportOptions As CrystalDecisions.Shared.ExportOptions Dim myDiskFileDestination As CrystalDecisions.Shared.DiskFileDestinationOptions Dim myExportFile...

Desperate Visual Studio .NET problem with Web Forms, please help
Hi, I've posted in the past about this problem and got no response, but now I'm desperate so have to try again. In Visual Studio .NET 2003, with .NET Framework 1.1, all web form controls (in fact all controls in the toolbar) are disabled. I create a webform.aspx page, I am in design view, but when I go to the "web forms" toolbar, I cannot drag anything to the page. I solved this last time by completely wiping my drive and spending three days reinstalling and updating everything. Everything in Visual Studio worked as expected for a few days, and now yet again everything is disabled. Can s...

Consuming c# .NET web service from VB
HI there, What a greate web site this is... and for my first post. An interesting problem concerning consuming a .NET web service from nasty old Visual Basic 6.0 using the MS Soap Toolkit. The issue I have is not the usual 'complex type' problem. I am not using a custom type mapper or the generic type mapper - IXMLDOMNodeList is working perfectly. The prototype for the web service (c#) is as follows: public bool StoreAuditMessages(string userId, string authenticationCode, AuditMessage[] auditMessages) the thrid paramter in the prototype is an array of the following type of ...

Date Picker Calendar Problem when running in Master/Content web form HELP PLZ!
All, I'm somewhat new to VS2005 and ASP .Net, so please bare with me.  I have a web form that has a textbox called txtStartDate.  Next to it I have placed a link to a page that contains a calendar control.  I want the end user to be able to click the link, open the calendar page and then select a date.  When a specific date is selected, that date is returned to the original page and the txtStartDate textbox is populated with said date. I have this working fine in a standard web form.  My problem is getting this to work on a web page that ...

windows forms in vb .net into web forms
we are creating a database driven website as part of our project. currently we have forms connecting to the database created in visual basic. these windows forms we need to convert into web forms which are asp .net compatible. can u give me an answer or show me a way. Hi, because of the difference in nature between web and win applications you'll need to reimplement at least the UI part. If you have a multitiered application in which the busines logic and data access are in different parts/assemblies you can reuse them. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Wor...

Visual Studio .NET cannot create or open the application. The likeliest problem is that required components are not installed on the local Web server. Run Visual Studio .NET setup and add the Web Deve
I installed Visual Studio .NET 2003 on Windows Vista Home Premuim, but I'm unable to select "Web Development" item from "Server Components" during the installation. I installed all the pre-requisits but I can not see Front Page Server Extention in the programs. I can see also the IIS. Appreciate if any one can guide me with the solution.   Thanks.   FPSE is not included with Vista, it's a separate download.  See www.iis.net for this. JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. Tha...

Adding future date to Datepicker form field field
Hello I have question about how to add correctly future date to date field. I noticed, that I can easily add current time with: var d=new Date(); form.setValues(targetfield1, form.dateToString(d)); But when I am trying to form expiration date for example 10 years from this day: expirationdate.setYear(expirationdate.getYear()+10); form.setValues(targetfield2, form.dateToString(expirationdate)); With IE It gives me correct date to datepicker field - Great - (I though that I am great java script guru)... 11/27/2017 BUT when date value has been saved to eDirectory - it is ...

How to convert a chinese date to english date in web form?
Hi ASP.NET Proz,  I try to convert a chinese charater date (18-一月-2008) to english date (18-Jan-2008) from a web form. Is that possible?  Thanks in advance for the Proz!  * .NET Proz always make impossible to possible Try this one:   System.Globalization.CultureInfo nlCulture = new System.Globalization.CultureInfo("zh-CHT"); // Chinese Traditional DateTime date = DateTime.MinValue; DateTime.TryParseExact(chineseDateString, "dd-MMM-yyyy", nlCulture, System.Globalization.DateTimeStyles.None, out date); ...

Unusual problem where form parameters are not being passed to a .NET form
Hi, I am using Visual Studio 2005 on Windows 2003 (64 bit) and have a very unusual problem and would appreciate any help. Requirement - The Web application is part legacy part ASP part .NET. I have a requirement to show a Cyrstal PDF report in a new browser window. To do this I load and auto submit an ASP form which submits to a .NET form that opens in a new window. The .NET form generates the Crystal PDF file and response.redirects to display the report in the new window. Problem - On my development manchine (which hosts the web server) the application works as planned. Howeve...

Web resources about - DATE field problem - asp.net.web-forms

Is–ought problem - Wikipedia, the free encyclopedia
The is–ought problem in meta-ethics as articulated by Scottish philosopher and historian David Hume (1711–76) is that many writers make claims ...

The problem with celebrity charities
THE world erupted in praise this week for one of the most generous acts in history.

"Old-timers, guys that are 60-plus, have no problem with a gang shower and whatever."
"The Gen X-ers are a little bit more sensitive to what they’re spending and what they’re expecting. And the millennials, these are the special ...

Rahm Emanuel op-ed: I own the problem of police brutality, and I'll fix it
Chicago is facing a defining moment on the issues of crime and policing and the even larger issues of truth and justice. To meet this moment, ...

Out-Of-Town Trip In The Nissan LEAF — No Problem
... driving to St. Petersburg, to Tampa, or south to Venice or Englewood is gone. The [&hellip Out-Of-Town Trip In The Nissan LEAF — No Problem ...

Michigan GOPer Blames School Problems On Black Children
Michigan state Senator Marty Knollenberg decided he'd be a wise guy and blame failing school districts on African-American kids during a debate. ...


Tallahassee Police Finally Admit Problems With Investigation Of Jameis Winston Rape Case
One of the most sinister things that came to light in the Jameis Winston case was how Florida State and local police protected athletes accused ...

Thursday's Must-Reads For Entrepreneurs: The Abandoned Shopping Cart Problem
Today’s news and insights for business owners, including: Does Gravity's Dan Price have something to hide?

Lawyers: Georgia Hasn't Resolved Problem With Execution Drug
Death row inmate's lawyers say Georgia hasn't resolved problem with its execution drug

Resources last updated: 12/6/2015 6:14:32 PM