| From: | Chris Angelico <rosuav(at)gmail(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Double types |
| Date: | 2012-09-18 22:27:40 |
| Message-ID: | CAPTjJmr3XiAEVubr_DbjPKYY5snowxEyHJ0OmQVNxbiicQr2yg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Wed, Sep 19, 2012 at 7:25 AM, Hall, Samuel L (Sam)
<sam(dot)hall(at)alcatel-lucent(dot)com> wrote:
>
> I have an application that writes an Excel Spreadsheet to postgres. For the values that go in number fields, I check the Excel values for dbnull and set the parameters to 0, like this: cmd.Parameters(9).Value = 0. Npgsql throws an error “format specifier was invalid” If I do this: cmd.Parameters(9).Value = convert.todouble(0) then it works fine.
>
> Visual Basic 2010, Postgres 9.1, npgsql 2.0.12.0
>
> Could somebody please explain this behavior?
It's a long time since I've used BASIC in any form, but I think a hash
suffix will make it a double; alternatively, put a decimal point in
it.
cmd.Parameters(9).Value = 0#
cmd.Parameters(9).Value = 0.0
I usually use 0.0 to represent a floating-point zero in most languages.
ChrisA
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2012-09-18 22:39:55 | Re: foreign key from array element |
| Previous Message | Kevin Grittner | 2012-09-18 21:31:04 | Re: checkpoint_timeout and archive_timeout |