Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 8552263397F for ; Mon, 23 Nov 2009 13:24:55 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 60191-01-3 for ; Mon, 23 Nov 2009 17:24:42 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from hrndva-omtalb.mail.rr.com (hrndva-omtalb.mail.rr.com [71.74.56.123]) by mail.postgresql.org (Postfix) with ESMTP id 7F252633859 for ; Mon, 23 Nov 2009 13:24:32 -0400 (AST) Received: from [167.120.214.235] (really [24.97.199.161]) by hrndva-omta02.mail.rr.com with ESMTP id <20091123172431323.JURJ18187@hrndva-omta02.mail.rr.com>; Mon, 23 Nov 2009 17:24:31 +0000 Message-ID: <4B0AC54E.2050005@rochester.rr.com> Date: Mon, 23 Nov 2009 12:24:30 -0500 From: Josh T User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Richard Broersma CC: pgsql-odbc@postgresql.org Subject: Re: VBA ADO Command Date Parameter Not Working References: <4B0AAE9D.9030201@rochester.rr.com> <396486430911230855n6f283472t90c04e02615c075f@mail.gmail.com> In-Reply-To: <396486430911230855n6f283472t90c04e02615c075f@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200911/62 X-Sequence-Number: 10111 Richard Broersma wrote: > on Mon, Nov 23, 2009 at 7:47 AM, Josh T wrote: >> What is the correct way to pass a date into a parameter so it gets >> into the database correctly? > > http://www.postgresql.org/docs/8.4/interactive/datetime-appendix.html > > This is how Postgresql accepts dates by default. There is a way to change this: > > http://www.postgresql.org/docs/8.4/interactive/datatype-datetime.html#DATATYPE-DATETIME-INPUT > http://www.postgresql.org/docs/8.4/interactive/runtime-config-client.html#GUC-DATESTYLE > >> [5.750]conn=03044168, query='INSERT INTO test_table (test_date) VALUES >> ('1900-05-07'::date);' > > It looks like the ODBC driver is make the conversion here. > Rather than passing the date in with the #...#. Could you pass it in > as a string? > Thanks, but trying as string gives me the same result cmd.Parameters.Append cmd.CreateParameter("@test_date", adDBDate, adParamInput, 4, "2009-11-23") -> results in 1900-05-07 in the DB I also get the same result in I leave the value out entirely cmd.Parameters.Append cmd.CreateParameter("@test_date", adDBDate, adParamInput) -> also results in 1900-05-07 in the DB Trying a string this way doesn't work at all cmd.Parameters.Append cmd.CreateParameter("@test_date", adVarChar, adParamInput, Len("2009-11-23"), "2009-11-23") -> throws an error on cmd.Execute -- ERROR: invalid input syntax for type date: "128"; Error while executing the query Thanks, Josh