It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

DateTime Querry

Moderator: dafunkymunky

DateTime Querry

Postby kangkungkernitz1081 on Tue Aug 26, 2008 2:54 am

hello,
Im desperately finding solution on my problem for almost one week but still i cannot find the right solution on my problem.
My problem is the dateTime of my application. When querrying a data on my Datagrid view with datetime i always get an error, im using the querry builder and also try to use the textbox and button to make querry but still i get an error.
here is my code....
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Me.PaymentsTableAdapter.FillByTransactionDate(Me.RecordsPaymentDataSet.Payments, CType(TransactionDateDateTimePicker.Text, Date))
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
-----(Converstion Failed when converting character string to smalldateTime data type) -error for this code.

So i try to convert the sting into datetime format....

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sDate As String = Format("MMM/dd/yyyy")

TransactionDateDateTimePicker.Text = Convert.ToDateTime(sDate)
Try
Me.PaymentsTableAdapter.FillByTransactionDate(Me.RecordsPaymentDataSet.Payments, CType(TransactionDateDateTimePicker.Text, Date))
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try

End Sub
-------(The String was not recognized as valid DateTime. There is unknown word starting at index 0) - error for this code.



So again i try to parse the sting into datetime......

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sDate As String = Format("MMM/dd/yyyy")
Date.TryParse(TransactionDateDateTimePicker.Text, sDate)
TransactionDateDateTimePicker.Text = Convert.ToDateTime(sDate)
Try
Me.PaymentsTableAdapter.FillByTransactionDate(Me.RecordsPaymentDataSet.Payments, CType(TransactionDateDateTimePicker.Text, Date))
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
-------(Conversion from string MMM/dd/yyyy to type date is not valid) -error for this code

Im checking for the format of my database and dataset for date "MMM/dd/yyyy" and for the property of textbox but still no answer!!!!
So PLEASE somebody on this forum.............. PLEASE HELP ME!!!!!!

Kangkungkernitz1081
kangkungkernitz1081
 
Posts: 3
Joined: Mon Aug 25, 2008 3:57 am
Location: philippines

Who is online

Users browsing this forum: No registered users and 3 guests