<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: datetimepicker query dates in sql server in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596456#M16046</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This is classic vb string building.&amp;nbsp; Your messagebox looks right because it concatenates the variables together.&lt;BR /&gt;&lt;BR /&gt;Does this work, add "'" (quote, single quote, quote) around your variables. Maybe it's + instead of &amp;amp;, been a long time since I VB'd anything.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;whereClause = "InspectionDate &amp;gt;= " &amp;amp; "'" &amp;amp; fromDate &amp;amp; "'" &amp;amp; " And InspectionDate &amp;lt;= " &amp;amp; "'" &amp;amp; toDate &amp;amp; "'"&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; That does work. All I was missing was the (quote, single quote, quote) , this is what I tried before your response. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; 'whereClause = "InspectionDate &amp;gt; " &amp;amp; fromDate &amp;amp; " " &amp;amp; "00:00:00" &amp;amp; " " &amp;amp; "AND" &amp;amp; " " &amp;amp; "InspectionDate &amp;lt; " &amp;amp; toDate &amp;amp; " " &amp;amp; "00:00:00" &amp;amp; " " '" &amp;amp; "AND" &amp;amp; " " &amp;amp; "FieldTechnician" = "Tech"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'whereClause = "InspectionDate &amp;gt; '2012-09-04 07:50:41' AND InspectionDate &amp;lt; '2012-10-04 07:44:04'" '&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'whereClause = "InspectionDate &amp;gt; " &amp;amp; fromDate &amp;amp; " " &amp;amp; " AND " &amp;amp; " " &amp;amp; "InspectionDate &amp;lt; " &amp;amp; toDate&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'whereClause = "InspectionDate &amp;gt; " &amp;amp; fromDate &amp;amp; " " &amp;amp; "and" &amp;amp; " " &amp;amp; "InspectionDate &amp;lt; " &amp;amp; toDate &amp;amp; ""&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; whereClause = "InspectionDate &amp;gt;= " &amp;amp; "'" &amp;amp; fromDate &amp;amp; "'" &amp;amp; " And InspectionDate &amp;lt;= " &amp;amp; "'" &amp;amp; toDate &amp;amp; "'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'whereClause = "InspectionDate &amp;lt; '2012-09-04 07:50:41'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'whereClause = "InspectionDate &amp;gt; #" &amp;amp; fromDate &amp;amp; "# AND InspectionDate &amp;lt; #" &amp;amp; toDate &amp;amp; "#"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' whereClause = "InspectionDate BETWEEN " &amp;amp; fromDate &amp;amp; " And " &amp;amp; toDate &amp;amp; ""&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'whereClause = "InspectionDate &amp;gt; " &amp;amp; fromDate &amp;amp; "00:00:00"&amp;nbsp; " " &amp;amp; "AND" &amp;amp; " " &amp;amp; "InspectionDate&amp;nbsp; &amp;lt;&amp;nbsp; " &amp;amp; toDate &amp;amp; 18:00:00""&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '" &amp;amp; "AND" &amp;amp; " " &amp;amp; "FieldTechnician" = "Tech"""&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The flat spot is starting to disappear. Thanks Much lesson learned.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Mar 2013 19:13:56 GMT</pubDate>
    <dc:creator>CaryRoberts</dc:creator>
    <dc:date>2013-03-05T19:13:56Z</dc:date>
    <item>
      <title>datetimepicker query dates in sql server</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596446#M16036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a form that has two datetimepicker's (From and To) I am trying to select dates from date time field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If I manually select dates with whereClause = "InspectionDate &amp;gt; '2012-09-04 07:50:41'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AND InspectionDate &amp;lt; '2012-10-04 07:44:04'" it will work. If I pass the value from the date time picker it wants to reformat the date.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried to re-format the date with Dim tDate As String = frmTech1.ToDatePicker.Value.ToString("yyyy-MM-dd") which works but I cannot query table with a string. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My where clause looks like this whereClause = "InspectionDate &amp;gt; " &amp;amp; vFrom &amp;amp; " " &amp;amp; "00:00:00" '&amp;amp; " " &amp;amp; "AND" &amp;amp; " " &amp;amp; "InspectionDate &amp;lt; " &amp;amp; vTo &amp;amp; " " &amp;amp; "00:00:00" &amp;amp; " " &amp;amp; "AND" &amp;amp; " " &amp;amp; "FieldTechnician" = "Tech" . &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How do I convert this string format (yyyy-MM-dd) back to a date?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cary Roberts , GISP&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CVMVCD&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2013 16:25:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596446#M16036</guid>
      <dc:creator>CaryRoberts</dc:creator>
      <dc:date>2013-02-28T16:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: datetimepicker query dates in sql server</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596447#M16037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Look at the API for C# (assuming), for something called DateTime.&amp;nbsp; It has a parse method for converting yyyyMMdd to a date.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;VB probably has something similar.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx"&gt;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2013 16:33:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596447#M16037</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2013-02-28T16:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: datetimepicker query dates in sql server</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596448#M16038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Looks like you are missing a single quote in the concatenation.&amp;nbsp; The way you build the where clause is very difficult to read and somewhat inefficient.&amp;nbsp; Each time you concatenate two strings it declares a new string, so the line bellow declares 13 new strings in memory...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"InspectionDate &amp;gt; " &amp;amp; vFrom &amp;amp; " " &amp;amp; "00:00:00" '&amp;amp; " " &amp;amp; "AND" &amp;amp; " " &amp;amp; "InspectionDate &amp;lt; " &amp;amp; vTo &amp;amp; " " &amp;amp; "00:00:00" &amp;amp; " " &amp;amp; "AND" &amp;amp; " " &amp;amp; "FieldTechnician" = "Tech" &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I prefer using the string.format function, in vb.net it looks like this (sorry it has been a little while since I last did C#)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;string.format (InspectionDate &amp;gt; '{0} 00:00:00' AND InspectionDate &amp;lt; '{1} 00:00:00' AND FieldTechnician = {2}", vFrom, vTo, Tech)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my experience it is a lot easy to spot syntax problems in a statement like that than some long series of &amp;amp;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another thing, you can pick up the hours, minutes and seconds in the datetime of the picker to string:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ToDatePicker.Value.ToString("yyyy-MM-dd HH:mm:ss")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Makes the where clause a little easier too.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Mar 2013 17:13:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596448#M16038</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2013-03-01T17:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: datetimepicker query dates in sql server</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596449#M16039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry I didn't post that I was using VB.Net.&amp;nbsp; Seems like every thing I'v read wants to convert the date to a string, and then when I convert back to date it takes the machine setting. So, when I do a custom format for datetimepicker as yyyy-MM-dd it shows in the form window as 2013-02-15 which is the date that I want to use for the whereclause. I have converted to string, parsed string for each value (year,day,month) and then converted back to date, but it shows as 2/15/2013 arrgg.&amp;nbsp; I tried your link and have read it many times (hunting for cure) but it deals with strings. Must be missing something here. I am new to .net, old vba guy. I have tried globalization and the culture thing, but still no,luck. Can I still query sqlserver date field which is formatted like this yyyy-MM-dd hh:mm:ss. with a date like this mm/dd/yyyy? I could manually select with the values with just the date and not the hms, so I will have to reduce the humongous where clause, never really got there yet because of the date thing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry for the rambling.&amp;nbsp; Any help is greatly appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Mar 2013 22:35:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596449#M16039</guid>
      <dc:creator>CaryRoberts</dc:creator>
      <dc:date>2013-03-01T22:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: datetimepicker query dates in sql server</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596450#M16040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am not sure why you want to take a date and convert it to a string and convert it back to a date...&amp;nbsp; Where clauses take strings, sql server will convert it back to a date to do its query internally.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 12:31:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596450#M16040</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2013-03-04T12:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: datetimepicker query dates in sql server</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596451#M16041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The only reason was to be in the same format as the date field. yyyy-MM-dd, hey, if I don't have to convert it to string and back to a date field great. I was using toDate = frmTech1.ToDatePicker.Value.ToString("yyyy-MM-dd"). So i shouldn't mess with format and leave it alone and sql server will format it correctly, is that what your saying?&amp;nbsp; So it should be toDate = frmTech1.ToDatePicker.value and the where clause would be what exactly?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 17:04:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596451#M16041</guid>
      <dc:creator>CaryRoberts</dc:creator>
      <dc:date>2013-03-04T17:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: datetimepicker query dates in sql server</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596452#M16042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The only reason was to be in the same format as the date field. yyyy-MM-dd, hey, if I don't have to convert it to string and back to a date field great. I was using toDate = frmTech1.ToDatePicker.Value.ToString("yyyy-MM-dd"). So i shouldn't mess with format and leave it alone and sql server will format it correctly, is that what your saying?&amp;nbsp; So it should be toDate = frmTech1.ToDatePicker.value and the where clause would be what exactly?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't think that would work...&amp;nbsp; I would think either you will get a type mismatch or the string returned by to the date picker will be whatever your locale is set which may or may not be wrong.&amp;nbsp; There are two issues here, the conversion of the .net datetime type to string and the conversion from string to the sql server datetime (or date, datetime2) format in sql server.&amp;nbsp; The .net tostring function is compiled when the .net code is compiled and executed on the local client at run time.&amp;nbsp; The where clause is then passed as a string to a sql server database (local or on a server) which interprets and executes the sql where clause.&amp;nbsp; In order to go from one the the other, you need a string in between to pass (whereclause.)&amp;nbsp; The format of the string sql server needs will dictate what format the string you need to make from the .net datetime tostring function.&amp;nbsp; Do you know the format the sql server needs to take in?&amp;nbsp; Can you use a t-sql convert function in the where clause specifying the type of string (sql server's way of specifying the format)?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 17:56:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596452#M16042</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2013-03-04T17:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: datetimepicker query dates in sql server</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596453#M16043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I don't think that would work...&amp;nbsp; I would think either you will get a type mismatch or the string returned by to the date picker will be whatever your locale is set which may or may not be wrong.&amp;nbsp; There are two issues here, the conversion of the .net datetime type to string and the conversion from string to the sql server datetime (or date, datetime2) format in sql server.&amp;nbsp; The .net tostring function is compiled when the .net code is compiled and executed on the local client at run time.&amp;nbsp; The where clause is then passed as a string to a sql server database (local or on a server) which interprets and executes the sql where clause.&amp;nbsp; In order to go from one the the other, you need a string in between to pass (whereclause.)&amp;nbsp; The format of the string sql server needs will dictate what format the string you need to make from the .net datetime tostring function.&amp;nbsp; Do you know the format the sql server needs to take in?&amp;nbsp; Can you use a t-sql convert function in the where clause specifying the type of string (sql server's way of specifying the format)?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; I think I got it. I set the variable to fromDate = frmTech1.FromDatePicker.Value.Date&amp;nbsp; and&amp;nbsp; fromDate is dimmed as Date. I perform the selection where clause as whereClause = "InspectionDate &amp;gt; " &amp;amp; fromDate &amp;amp; "" and it selected the values, all I need to do now is put multiple selections together. I previously just set the variable as value and nor as value.date.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 18:02:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596453#M16043</guid>
      <dc:creator>CaryRoberts</dc:creator>
      <dc:date>2013-03-04T18:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: datetimepicker query dates in sql server</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596454#M16044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I think I got it. I set the variable to fromDate = frmTech1.FromDatePicker.Value.Date&amp;nbsp; and&amp;nbsp; fromDate is dimmed as Date. I perform the selection where clause as whereClause = "InspectionDate &amp;gt; " &amp;amp; fromDate &amp;amp; "" and it selected the values, all I need to do now is put multiple selections together. I previously just set the variable as value and nor as value.date.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Im at a standstill here trying to figure out the whereclause. I have two variables toDate and fromDate both strings equal to frmtech1.toDatePicker.Value and frmTech1.fromDatePicker.value. My selection where clause is whereclause = "InspectionDate &amp;gt;= " &amp;amp; fromDate&amp;nbsp; this works. If I try to append to the where clause like this whereClause = "InspectionDate &amp;gt;= " &amp;amp; fromDate &amp;amp; " And InspectionDate &amp;lt;= " &amp;amp; toDate it doesn't work. I put into MsgBox and got this "InspectionDate &amp;gt;= 2/11/2013 And InspectionDate &amp;lt;= 2/22/2013" looks good to me but doesn't work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I took it apart and tried just less than, whereclause = "InspectionDate &amp;lt;= &amp;amp; fromDate it doesn't work. Which leads me to believe its a problem with the &amp;lt; or &amp;lt;=. I checked the format of the datepicker and both are formatted the same. Sql server values from the &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;select by attributes box is "InspectionDate &amp;lt; '2012-09-04 07:50:41'" this works and it also works if I choose to use just the date in the same format as the string variable 2/05/2013 without the time. I am befuddled here, I have a flat spot on my head where I have been beating it. Visual Studio 2008 Any help would be greatly appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2013 17:23:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596454#M16044</guid>
      <dc:creator>CaryRoberts</dc:creator>
      <dc:date>2013-03-05T17:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: datetimepicker query dates in sql server</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596455#M16045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;If I try to append to the where clause like this whereClause =&amp;nbsp; "InspectionDate &amp;gt;= " &amp;amp; fromDate &amp;amp; " And InspectionDate &amp;lt;= "&amp;nbsp; &amp;amp; toDate it doesn't work.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is classic vb string building.&amp;nbsp; Your messagebox looks right because it concatenates the variables together.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does this work, add "'" (quote, single quote, quote) around your variables. Maybe it's + instead of &amp;amp;, been a long time since I VB'd anything.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;whereClause = "InspectionDate &amp;gt;= " &amp;amp; "'" &amp;amp; fromDate &amp;amp; "'" &amp;amp; " And InspectionDate &amp;lt;= " &amp;amp; "'" &amp;amp; toDate &amp;amp; "'"&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2013 17:53:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596455#M16045</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2013-03-05T17:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: datetimepicker query dates in sql server</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596456#M16046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This is classic vb string building.&amp;nbsp; Your messagebox looks right because it concatenates the variables together.&lt;BR /&gt;&lt;BR /&gt;Does this work, add "'" (quote, single quote, quote) around your variables. Maybe it's + instead of &amp;amp;, been a long time since I VB'd anything.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;whereClause = "InspectionDate &amp;gt;= " &amp;amp; "'" &amp;amp; fromDate &amp;amp; "'" &amp;amp; " And InspectionDate &amp;lt;= " &amp;amp; "'" &amp;amp; toDate &amp;amp; "'"&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; That does work. All I was missing was the (quote, single quote, quote) , this is what I tried before your response. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; 'whereClause = "InspectionDate &amp;gt; " &amp;amp; fromDate &amp;amp; " " &amp;amp; "00:00:00" &amp;amp; " " &amp;amp; "AND" &amp;amp; " " &amp;amp; "InspectionDate &amp;lt; " &amp;amp; toDate &amp;amp; " " &amp;amp; "00:00:00" &amp;amp; " " '" &amp;amp; "AND" &amp;amp; " " &amp;amp; "FieldTechnician" = "Tech"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'whereClause = "InspectionDate &amp;gt; '2012-09-04 07:50:41' AND InspectionDate &amp;lt; '2012-10-04 07:44:04'" '&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'whereClause = "InspectionDate &amp;gt; " &amp;amp; fromDate &amp;amp; " " &amp;amp; " AND " &amp;amp; " " &amp;amp; "InspectionDate &amp;lt; " &amp;amp; toDate&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'whereClause = "InspectionDate &amp;gt; " &amp;amp; fromDate &amp;amp; " " &amp;amp; "and" &amp;amp; " " &amp;amp; "InspectionDate &amp;lt; " &amp;amp; toDate &amp;amp; ""&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; whereClause = "InspectionDate &amp;gt;= " &amp;amp; "'" &amp;amp; fromDate &amp;amp; "'" &amp;amp; " And InspectionDate &amp;lt;= " &amp;amp; "'" &amp;amp; toDate &amp;amp; "'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'whereClause = "InspectionDate &amp;lt; '2012-09-04 07:50:41'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'whereClause = "InspectionDate &amp;gt; #" &amp;amp; fromDate &amp;amp; "# AND InspectionDate &amp;lt; #" &amp;amp; toDate &amp;amp; "#"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' whereClause = "InspectionDate BETWEEN " &amp;amp; fromDate &amp;amp; " And " &amp;amp; toDate &amp;amp; ""&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'whereClause = "InspectionDate &amp;gt; " &amp;amp; fromDate &amp;amp; "00:00:00"&amp;nbsp; " " &amp;amp; "AND" &amp;amp; " " &amp;amp; "InspectionDate&amp;nbsp; &amp;lt;&amp;nbsp; " &amp;amp; toDate &amp;amp; 18:00:00""&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '" &amp;amp; "AND" &amp;amp; " " &amp;amp; "FieldTechnician" = "Tech"""&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The flat spot is starting to disappear. Thanks Much lesson learned.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2013 19:13:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596456#M16046</guid>
      <dc:creator>CaryRoberts</dc:creator>
      <dc:date>2013-03-05T19:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: datetimepicker query dates in sql server</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596457#M16047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I still think the user of string.format would avoid all this concatenation complexity.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Mar 2013 12:20:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596457#M16047</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2013-03-06T12:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: datetimepicker query dates in sql server</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596458#M16048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Be new to VB.Net and Visual Studio, I remember when everything was esri.core and alot of the commands seemed much simpler.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am intrigued by your where clause in a string.format function, I will have to look at that later. Just trying to get up to speed after a bit of a layoff. Trying to figure out what SQL wants, what the VS will give you and the settings on the development box can be a little confusing especially when it comes to dates. Thanks again Mr. Gray&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Mar 2013 13:24:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/datetimepicker-query-dates-in-sql-server/m-p/596458#M16048</guid>
      <dc:creator>CaryRoberts</dc:creator>
      <dc:date>2013-03-06T13:24:58Z</dc:date>
    </item>
  </channel>
</rss>

