Guys I want to insert a Null dateTime Value into SQL database connected to C# desktop application. I'm using following code. I can insert Null dateTime Value into database, but I am having problem with how to update dateTime picker value and saving it into database.. I'm posting my code below.. Please help me guys.. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace Datetimepicker { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { //to load the images butadd.Image = Imageslist.Images[0]; …

Member Avatar
Member Avatar
+0 forum 4

[CODE]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link rel="stylesheet" href="css/jquery.datepick.css" type="text/css" /> <script type="text/javascript" src="js/jquery-1.4.2.js"></script> <script type="text/javascript" src="js/jquery.datepick.js"></script> <script type = "text/javascript"> function updateSelected(dates) { $('#selectedMonth').val(dates.length ? dates[0].getMonth() + 1 : ' '); $('#selectedDay').val(dates.length ? dates[0].getDate() : ' '); $('#selectedYear').val(dates.length ? dates[0].getFullYear() : ' '); checkLinkedDays(); } $('#selectedPicker').datepick( { minDate: '01/01/2001', maxDate: '12/31/2010', alignment: 'bottomRight', onSelect: updateSelected, showTrigger: '#calImg'}); $('#selectedMonth, #selectedDay, #selectedYear').change(function() { $('#selectedPicker').datepick('setDate', new Date ($('#selectedYear').val(), $('#selectedMonth').val() - 1, $('#selectedDay').val()));}); </script> </head> <body> <table width="200" border="1"> <tr> <td> <select name="selectedMonth" id="selecetedMonth"> <option value="Jan">Jan</option> <option value="Feb">Feb</option> <option value="Mar">Mar</option> <option …

Member Avatar
Member Avatar
+0 forum 5

Hi, I'm new to vb and I need to record the time the user used a certain privilege and the time s/he finished using it. i used date/time picker but whenever i run the program, i can't edit the time. only the date. help please?

Member Avatar
Member Avatar
+0 forum 4

i search a lot of reference in web, but still im not satisfied to solve this problem, i used datetimepicker in vb.net to retrieve from database. i am using BETWEEN statement to search the specific date and its data. here is my code to search the data with specific date, i have to datepicker: Dim sqlquery As String = "SELECT complaint.*,solution.* FROM complaint LEFT JOIN solution ON complaint.tran_no=solution.tran_no WHERE complaint.status='finished' AND complaint.sys_name LIKE '%" & cbosyshis.Text & "%' AND complaint.mod_name LIKE '%" & txtmodhis.Text & "%' AND complaint.dte BETWEEEN '" & date1.text & "' AND '" & date2.text & "'" …

Member Avatar
Member Avatar
+0 forum 1

Hi all! I have a user interface where I want to filter a datagridview.. I 've achieved to create filters but I 've failed to filter tha data by date.. I have a sql db and the column of date is of datetime type. When I try to filter the data by choosing a date in a datetimepicker I use this query: [CODE] If TodayToolStripMenuItem.Checked = True Then query = "Select * from INCIDENTS where DateReported='" & dtpEqualTo.Value.Date & "'"[/CODE] The problem is that when I run the project I take the message "The conversion of a varchar type to …

Member Avatar
Member Avatar
+0 forum 6

Does anyone have any idea how to set the DateTimePicker's UpDown buttons to add/minus 30mins only instead of 1min?

Member Avatar
Member Avatar
+0 forum 4

hey people. ok.. this is what i NEED to do.. Task > 1. User will add TODO list in the textbox shown in the GUI Windows Form. > 2. User will also select the date on which the task will be done. > 3. Once entered the above information, user will click on Add TODO button and the TODO > text from the textbox will be added to the listbox shown on the bottom of the Windows > Form. > 4. User can add as many items as he wants. > 5. If user has entered a task in June …

Member Avatar
Member Avatar
+0 forum 3

I have a simple data input form in which when the form is activated if sets focus on a textbox and sets the back color. I later have a datetimepicker control. The tab stops are coreectly set but when ever the users selects a a date from the datetimepicker the form seems to send a form activated event, because the cursur/focus moves to the first textbox instead of the next tab stop. If I comment out the "form activated" event the form functions properly. Why does this happen? Does the datetimepicker send "form activated"? How can I work around this. …

Member Avatar
Member Avatar
+0 forum 5

i have a datetimepicker and a textbox i code inside in the datetimepicker Private Sub DateTimePicker2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker2.ValueChanged TextBox1.Text = DateTimePicker2.Value.ToString ''7/16/2015 9:03:03'' PM is the output i my textbox, how i will remove the time when i input a date from the datetimepicker? thank you

Member Avatar
Member Avatar
+0 forum 2

Please help me debug about datetimepicker. I think, the code is written correctly but its not. The program kee[s prompting **ORA-01858: a non-numeric character was found where a numeric was expected** Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim cmd As New OleDb.OleDbCommand 'cnn.ConnectionString = ConfigurationManager.ConnectionStrings("mysys.My.MySettings.ConnectionString").ConnectionString() cnn.ConnectionString = "Provider=OraOLEDB.Oracle; Data Source=TRAVELMATE-PC/XE;User Id=cj;Password=me;" If Not cnn.State = ConnectionState.Open Then cnn.Open() End If cmd.Connection = cnn cmd.CommandText = "INSERT INTO room(tenant_id, room_number, room_name, bed_number)" & _ "VALUES ('" & Me.TextBox1.Text & "','" & Me.ComboBox4.Text & "','" & Me.ComboBox5.Text & "','" & Me.ComboBox6.Text & "')" cmd.CommandText = "INSERT …

Member Avatar
Member Avatar
+0 forum 1

Hello, i got this error when i click my button save. Error: .Net SqlClient Data Provider: Conversion failed when converting datetime from character string. please help me... this is my save button code: Private Sub btnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimpan.Click Dim check As Integer Dim conn As SqlClient.SqlConnection Dim cmdStudent As New SqlClient.SqlCommand Dim cmdStudent1 As New SqlClient.SqlCommand Dim daStudent As New SqlClient.SqlDataAdapter Dim dsStudent As New DataSet Dim dtStudent As New DataTable If txtKosPerolehan.Text = "" Or cbTarikhJaminan.Text = "" Or txtAksesori.Text = "" Or cbPembekal.Text = "" Then MsgBox("Penuhkan Borang!", MsgBoxStyle.OkOnly) Else If …

Member Avatar
Member Avatar
+0 forum 2

I try to filter my datagridview with a datetimepicker. When the datetime value is just date (eg.15/5/2010) everything work fine. But when there is also date and time value occurs conversion problem "conversion failed when converting date and/or time from character string". Iused also combobox populated with the dattime values but i confronted the same problem.. My goal is to calculate the average readings of a meter. Every next reading is equal to the previous one plus the last period consumption (energy meter). First I calculate the difference between the two readings (which correspond to the dates user choose from …

Member Avatar
Member Avatar
+0 forum 2

Hello all! I would like your help please.. I have a datetimepicker and I want to use it for the time part only! So, I would like to disable its dropdown calendar.. Thank you in advance!

Member Avatar
Member Avatar
+0 forum 3

Hello Friends, I need help to get the time value from MSSQL database to VB.Net Datetimepicker I have a datetimepicker but the custom format is set to HH:mm tt so that I can get eg 11:20 AM this value I have stored in database with the help of ` Label4.Text = DateTimePicker3.Value.ToShortTimeString` but now if I want to get the same value from database to datetimepicker what shud be done??? please do help me on this Thanks in advance

Member Avatar
Member Avatar
-1 forum 10

Hi, I'm having a problem with a datetimepicker and databinding. I bind the text of the picker to a value from the database and it works perfectly fine and shows the value correctly, however whenever i change the text in the datetimepicker field to update, it changes, BUT gets back again to its original value when i advance to another textfield or any other control on the form. anyone has an idea why this is happening?

Member Avatar
Member Avatar
+0 forum 2

I'm creating a custom `ComboBox` that allows the user to select a date; the calendar display is localized making the built-in `DateTimePicker` undesirable (see [here](http://support.microsoft.com/Default.aspx?scid=kb;en-us;889834&x=18&y=19) for more information). I need the UI control to mirror the look and feel or the existing components. Here's what I've tried and the problems I've encountered: * Using a `TextBox` with a drawn `ComboBox` button: I've tried using `ComboBoxRenderer.DrawDropDownButton` but the look and feel does not mirror the existing UI controls. In particular we don't have `Application.EnableVisualStyles()` so the buttons have a Windows 98 look and feel. `ComboBoxRenderer` draws a glossy grey button. * …

Member Avatar
+0 forum 0

My form has a TextBox with values like(e.g: P011112, C0212102) those are products lot numbers that the user enters. Then, what i want is that a DateTimePicker takes the first 4 digits as "MM-yyyy" and add 3 years to that date. Example: TextBox.text = P011112 DateTimePicker = January, 2014 Thanks in advance

Member Avatar
Member Avatar
+0 forum 2

Good Day Programmer's ^_^ i'm having a problem with this two DateTimePicker in DateTimePicker1 the format or value is "dd-MMM-yyyy" or "01/Jan/2012" and in DateTimePicker2 the format or value is "yyyy" or "2012" when i change the year in DateTimePicker2 to change the year in DateTimePicker1 i'm getting an error.. how do i change only the Year in DateTimePicker1 base on the DateTimePicker2 that i change?? that the DATE on DateTimePicker1 will not change, how to do that?? [ATTACH]23672[/ATTACH]

Member Avatar
Member Avatar
+0 forum 3

GOOD DAY PROGRAMMERS!! :twisted: i just want to know How to do this kind of problem [url]http://www.daniweb.com/forums/attachment.php?attachmentid=23623&stc=1&d=1327489022[/url] i just want to save the date interval like i will select the Start Date and End Date ex. [COLOR="Red"]Start Date/Time: 26-Jan-12 / 03:00:00 PM End Date/Time: 31-Jan-12 / 03:00:00 PM [/COLOR] how do i save the 27,28,29,30 date??? same time... :idea: HELP please.... BTW here's my code i used to save the date and time... [CODE] Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim xSQL As New System.Text.StringBuilder xSQL.AppendLine("INSERT INTO tblSample") xSQL.AppendLine("(DateDeliver,TimeDeliver,NumOfDays,DateReturn,TimeReturn)") xSQL.AppendLine("VALUES") xSQL.AppendLine("(@DD,@TD,@ND,@DR,@TR)") Dim bReturn As …

Member Avatar
Member Avatar
+0 forum 5

hh.. how can i get the value accumulated from the date i select from datetimepicker1 to datetimepicker2 in vb.net and mysql? the value here refers to the daily sales and i need to find the total sales between the range dates that i choose.. please help me..as im beginner and my knowledge is limited.. thanks in advance..

Member Avatar
Member Avatar
+0 forum 4

hi i have a question relating to a date time picker, i have a form that i have the employee name and all the emaloyee details such as the employee DOB. whena user selects a user from the combo box the details from the database is being taken and displayed in the form. that thing is i have a date time picker and in the form load i have the code [CODE] dpDOB.Format = DateTimePickerFormat.Custom; dpDOB.CustomFormat = " "; [/CODE] and in the datetime picker close up i have the code [CODE] dpDOB.Format = DateTimePickerFormat.Short; [/CODE] and when it shows …

Member Avatar
Member Avatar
+0 forum 2

hi. i just want to ask how can i populate a listview n vb.net that has a is limited by a date from and date to. i have a datetimepicker for start date and datetimepicker for end date and i want do list all the entry of my database in listview that is within the range of the start date and end date. thanks in advance

Member Avatar
Member Avatar
+0 forum 5

Hi I am trying to set a larger calendar font (Calendarfont) for a Datetimepicker control, but vb.net (2010) doesn't seem to use/honor it. It remains the same (very small) regardless of the font/size I choose. Have also tried changing it in program on the onload of my form but that doesn't change anything either. Any ideas why? Thanks, Scott

Member Avatar
Member Avatar
+0 forum 4

Hey guys, I'm want to retrieve results from the database, where datetime picker given value, is equal to database value. var _check = (from day in Check.tbl_employees where day.d_from== _frm && day.d_to == _to select new { day.desg_id, }).FirstOrDefault(); datetime picker gives a value with its time,but i'm only interested in date.so i need help to compare in date which gives from the datetime picker(_from and _to) in database value(day.d_from,day.d_to). And when comparing dates,does it compare time too? need help ASAP. thanks in advance. drax

Member Avatar
Member Avatar
+0 forum 1

I am getting the value of a datetime picker and add it in the database but it is throwing an exception saying : [COLOR="Red"]The conversion of a char data type to a datetime data type resulted in an out-of-range datetime. The statement has been terminated.[/COLOR] This is my SQL Statement [CODE] public bool AddStaff(Staff s) { bool StaffUnique = IsUnique(s); if (StaffUnique) { try { conn.Open(); SqlCommand comm = new SqlCommand("INSERT INTO tblStaff VALUES ('" + s.IDCardNumber + "','" + s.FirstName + "','" + s.LastName + "','" + s.DateOfBirth + "','" + s.Gender + "','" + s.Address1 + "','" + …

Member Avatar
Member Avatar
+0 forum 18

Friends, I am zero in PHP, but still i have managed to do something to fulfill my requirement. I am stuck with one thing now..So i need help on.... I am using one html+php form to submit database into mysql. I created a display of that table through php script on a webpage. Now i want a datepicker option on that displayed page by which i should able to select the date range and display the data of that date range from my mysql table. And then take a export of data displayed of selected date range in excel. This …

Member Avatar
Member Avatar
+0 forum 6

Hi All, Can I put text in datetimepicker. Instead of it showed the dafault date and time (today's date), can I put text like e.g - Please Select Date - Looking forward to hear from u guys soon... URGENT

Member Avatar
Member Avatar
+0 forum 5

hi, i have a two datetime picker in a C# form, when i select a earlier date (before today date) there is a caparison i have addded to the validateing event in the date timepicker.below is the code. Question 1: for some reason say that i add 10th may, the messagebox msg will iterate until it comes to the current date.why is this happening. Question 2: the evet is fired only whe i select the other datetime picker.them is will give the previous datetimepicker message box error and open the datetimepicker of the secomd datetimepicker combo box how can i …

Member Avatar
Member Avatar
+0 forum 9

I have a datetimepicker which reads a date as dd-mm-yyyy. the sql im using(sql server 2008) is only reading mm-dd-yyyy. i am having a problem with changing the format of how the date is saved. i put a catch to the code and this came up System.Data.OleDb.OleDbException: Conversion failed when converting date and/or time from character string. at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at WindowsFormsApplication1.Customer.Add() in C:\Users\Neville\Desktop\ThunderBolt Technologies Ltd\ThunderBolt Technologies Ltd\Customer.cs:line 53 when i run the program the date is represented as follows: 20/3/2011 but i want the month to come first... is this coming from sql server settings? …

Member Avatar
Member Avatar
+0 forum 4

Hi there, I have a problem in datetimepicker in the interface in C#. I have restricted the user for entering a date that has passed by the below code dpSignedSO.Value = DateTime.Today; dpSignedSO.MinDate = DateTime.Today; but when the date is entered as 7/20/2010 and this is being saved to the database. When I try to get the values from the database the next day it gives an error message saying “ArgumentOutOfRangeException” which further explains as “Value of '7/20/2010 1:43:25 PM' is not valid for 'Value'. 'Value' should be between 'MinDate' and 'MaxDate'. Parameter name: Value” How can I avoid this …

Member Avatar
Member Avatar
+0 forum 4

The End.