Need Help Resolving 'Conversion from type DBNull to type Integer is not valid' Error During Weather Data Import

2 views
Skip to first unread message

bharadwaj mandala

unread,
Jun 29, 2026, 2:05:54 PM (3 days ago) Jun 29
to QSWAT+

Hello everyone,

I am currently working with QSWAT and am encountering the following error while importing precipitation data:

Error:

Conversion from type 'DBNull' to type 'Integer' is not valid.

The error occurs during the Weather Data Definition → Precipitation Data step, specifically while the progress bar shows "Calculating distance to stations."

Here are the details of my setup:

  • I am using a single precipitation station.
  • My pcpINDEX.txt file contains:
    • Station ID: 1
    • Station Name: pcp1
    • Latitude: 39.70
    • Longitude: -75.12
    • Elevation: 42 m
  • The precipitation data file (pcp1.txt) starts with the date 20100101 followed by daily rainfall values in the required SWAT format.
  • The actual weather station coordinates are:
    • Latitude: 39.67
    • Longitude: -75.33
    • Elevation: 6.1 m

I have checked the pcpINDEX.txt and precipitation file format, and both appear to be correct. and for reference i attached them

please help me in this regard.

best regards,
Bharadwaj Mandala

pcp1.txt
Screenshot 2026-06-29 132538.png
pcpINDEX.txt

Chris George

unread,
Jun 29, 2026, 2:11:00 PM (3 days ago) Jun 29
to bharadwaj mandala, QSWAT+
Try removing the blank lines in pcpINDEX.txt

Chris

On 6/29/2026 6:30 PM, bharadwaj mandala wrote:
> Hello everyone, I am currently working with QSWAT and am encountering
> the following error while importing precipitation data: Error:
> Conversion from type 'DBNull' to type 'Integer' is not valid. The error
> occurs during the Weather Data Definition
> ZjQcmQRYFpfptBannerStart
> This Message Is From an External Sender
> This message came from outside your organization.
> ZjQcmQRYFpfptBannerEnd
>
> Hello everyone,
>
> I am currently working with QSWAT and am encountering the following
> error while importing precipitation data:
>
> Error:
>
> /Conversion from type 'DBNull' to type 'Integer' is not valid./
>
> The error occurs during the Weather Data Definition → Precipitation Data
> step, specifically while the progress bar shows "Calculating distance to
> stations."
>
> Here are the details of my setup:
>
> * I am using a single precipitation station.
> * My pcpINDEX.txt file contains:
> o Station ID: 1
> o Station Name: pcp1
> o Latitude: 39.70
> o Longitude: -75.12
> o Elevation: 42 m
> * The precipitation data file (pcp1.txt) starts with the date 20100101
> followed by daily rainfall values in the required SWAT format.
> * The actual weather station coordinates are:
> o Latitude: 39.67
> o Longitude: -75.33
> o Elevation: 6.1 m
>
> I have checked the pcpINDEX.txt and precipitation file format, and both
> appear to be correct. and for reference i attached them
>
> please help me in this regard.
>
> best regards,
> Bharadwaj Mandala
>
> --
> You received this message because you are subscribed to the Google
> Groups "QSWAT+" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to qswatplus+...@googlegroups.com
> <mailto:qswatplus+...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/
> qswatplus/8aa33af2-1ba3-4715-b357-7f73a52ff3c8n%40googlegroups.com
> <https://urldefense.com/v3/__https://groups.google.com/d/msgid/
> qswatplus/8aa33af2-1ba3-4715-b357-7f73a52ff3c8n*40googlegroups.com?
> utm_medium=email&utm_source=footer__;JQ!!KwNVnqRv!
> EYJ7bRuq5pjRaWU_0hW6HmM2FAtdejQwOpVpZ8kZD7e_gZRmoL7AqpMZCaxTNM4EjcDzGRk1Ro1S7DR5t87nFw$>.

Reply all
Reply to author
Forward
0 new messages