vb.net date format from textbox > MS SQL query
Posted
by Jonesy
on Stack Overflow
See other posts from Stack Overflow
or by Jonesy
Published on 2010-04-16T14:15:56Z
Indexed on
2010/04/16
15:43 UTC
Read the original article
Hit count: 303
Hi folks,
I have a date column in a DB tabel that I want to query using a date taken from textbox.text. the user selects a date from the calendar in the format dd/MM/yyyy. I want to use that date to put into a query. How do i format the date to be able to query the database?
Dim datefrom As String =txtDateFrom.Text
Dim dateto As String =txtDateTo.Text
The query will look like this:
WHERE (tblClient.ClientID = " & ClientID & ") AND (tblBackupArchive.BackupDate BETWEEN '" + datefrom + "' AND '" + dateto + "')"
I'm using MS SQL Server btw. Any help most appreciated.
Jonesy
© Stack Overflow or respective owner