473,386 Members | 1,706 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,386 software developers and data experts.

Delete Date

BD
Developing C# windows forms application in Visual Studio 2005 to
access SQL Server 2005 on remote server. On one form I have a textbox
to enter short date. If I delete the date in the textbox, it does not
validate and therefore will not update the server. I know I should
enter null value but have been unsuccessful.

Aug 17 '07 #1
5 1765
BD wrote:
Developing C# windows forms application in Visual Studio 2005 to
access SQL Server 2005 on remote server. On one form I have a textbox
to enter short date. If I delete the date in the textbox, it does not
validate and therefore will not update the server. I know I should
enter null value but have been unsuccessful.
Can you post your insert statement?
Aug 17 '07 #2
BD
On Aug 17, 8:34 am, Mick Walker <materiali...@privacy.netwrote:
BD wrote:
Developing C# windows forms application in Visual Studio 2005 to
access SQL Server 2005 on remote server. On one form I have a textbox
to enter short date. If I delete the date in the textbox, it does not
validate and therefore will not update the server. I know I should
enter null value but have been unsuccessful.

Can you post your insert statement?
I do not have an insert statement at the present. I am migrating from
MSACCESS to C# and learning a new language, so therefore, having a
problem coding the statement. I can tell you, the column in SQL is
DATETIME and on the application I am only interested in short date not
time. Thought about using DateTimePicker control but found I could
not blank out or Null the textbox. Also found I could not delete the
value in the textbox.

Aug 17 '07 #3
BD wrote:
On Aug 17, 8:34 am, Mick Walker <materiali...@privacy.netwrote:
>BD wrote:
>>Developing C# windows forms application in Visual Studio 2005 to
access SQL Server 2005 on remote server. On one form I have a textbox
to enter short date. If I delete the date in the textbox, it does not
validate and therefore will not update the server. I know I should
enter null value but have been unsuccessful.
Can you post your insert statement?

I do not have an insert statement at the present. I am migrating from
MSACCESS to C# and learning a new language, so therefore, having a
problem coding the statement. I can tell you, the column in SQL is
DATETIME and on the application I am only interested in short date not
time. Thought about using DateTimePicker control but found I could
not blank out or Null the textbox. Also found I could not delete the
value in the textbox.
Use System.DBNull.Value to insert null values.

i.e
if(txtDate != null) {
// Do Stuff
} else {
// Insert System.DbNull.Value
}
Aug 17 '07 #4
BD
On Aug 17, 9:10 am, Mick Walker <materiali...@privacy.netwrote:
BD wrote:
On Aug 17, 8:34 am, Mick Walker <materiali...@privacy.netwrote:
BD wrote:
Developing C# windows forms application in Visual Studio 2005 to
access SQL Server 2005 on remote server. On one form I have a textbox
to enter short date. If I delete the date in the textbox, it does not
validate and therefore will not update the server. I know I should
enter null value but have been unsuccessful.
Can you post your insert statement?
I do not have an insert statement at the present. I am migrating from
MSACCESS to C# and learning a new language, so therefore, having a
problem coding the statement. I can tell you, the column in SQL is
DATETIME and on the application I am only interested in short date not
time. Thought about using DateTimePicker control but found I could
not blank out or Null the textbox. Also found I could not delete the
value in the textbox.

Use System.DBNull.Value to insert null values.

i.e
if(txtDate != null) {
// Do Stuff
} else {
// Insert System.DbNull.Value
}- Hide quoted text -

- Show quoted text -
How do I handle the validation process? Would I need to insert this
into the validating event?

Aug 17 '07 #5
On Fri, 17 Aug 2007 06:25:00 -0700, BD <bw******@charter.netwrote:
>Developing C# windows forms application in Visual Studio 2005 to
access SQL Server 2005 on remote server. On one form I have a textbox
to enter short date. If I delete the date in the textbox, it does not
validate and therefore will not update the server. I know I should
enter null value but have been unsuccessful.
Personally I'd try to avoid this problem by using a datepicker
control, that allows null values to be specified. You can then in your
code react as appropriate based on whether the user provided a date or
a null, without needing to validate anything

--
http://bytes.thinkersroom.com
Aug 20 '07 #6

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

Similar topics

2
by: r | last post by:
I am trying to do a delete query like this one: DELETE FROM pending WHERE pages.url=pending.url AND pages.date=pending.date; If I run it (via PHP) I get the following error: Unknown table...
1
by: Mark Reed | last post by:
Hi All, I have a table with a date field and 6 number fields. The number fields are not in numerical order across the fields and I want number 1 to be the lowest number and number 6 to be the...
6
by: Mark Reed | last post by:
Hi all, Please help. I have a table with 2 fields of which I am trying to change a select query into a delete query. the select query is: SELECT Table1.Date, Min(Table1.Ball) AS MinOfBall...
2
by: Dalan | last post by:
Having searched the archives regarding a Delete Query, I found nothing specific to my need, although there seems to be a plethora of ideas and suggestions on queries in general. I have used Delete...
6
by: paulwilliamsonremove | last post by:
Hi, I have two queries: "qryHistoryPersonIDs" that just contains the "personID" numeric field, and "qryDonations" that just contains the "personID" field, and a date field ("dDonationDate"). ...
1
by: Matt | last post by:
I am writing a DELETE statement and I want to filter the records using another SELECT statement. My SELECT statement is a GROUP BY query that grabs all social security numbers from the "Data...
2
by: Thomas Bauer | last post by:
Hello, Call DeleteFiles bgW_DeleteFilesProcess = new DeleteFiles(); bgW_DeleteFilesProcess.RunAsync( folder, 5, "*.txt", new RunWorkerCompletedEventHandler( RunWorkerCompleted_DeleteFiles_TXT )...
3
by: myth0s | last post by:
Hello! In VB.NET I have a GridView that shows a list of dates and beside each date there's a delete button. For a reason I don't know, the delete event seems to be fired twice, but I have...
29
by: shivasusan | last post by:
Hi! I can add rows with inputs to my HTML table dynamically using DOM, but I cannot remove selected rows. In fact, every row contains a Delete button. So, user selects the rows to remove, clicks...
4
by: Dan2kx | last post by:
Hello everyone, i have another task to complete, i have two tables tblEvent -EventID - PK Auto -PermaID - FK Num - tblPermavent -Date - Date
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.