SWAT Input Table Error: Syntax Error?

1,447 views
Skip to first unread message

Chris Hickey

unread,
Sep 16, 2013, 10:33:02 AM9/16/13
to arc...@googlegroups.com
I receive the error message while creating the input tables:


Syntax Error in INSERT INTO statement: IN, mWriteInputFiles.wgn

--------

So, I checked the databases under Edit Swat Inputs.  Under the weather files database I receive this error for every one of the 29 user-defined weather stations that I input into the SWAT2012 mdb file.

An error box with this message appears when I click on the weather station:

Conversions from type 'DBNull' to type 'String' is not valid

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.InvalidCastException: Conversion from type 'DBNull' to type 'String' is not valid.
   at Microsoft.VisualBasic.CompilerServices.Conversions.ToString(Object Value)
   at SWAT_InputFileEdit.frmUserWgnEdit.lstWeather_SelectedValueChanged(Object sender, EventArgs e)
   at System.Windows.Forms.ListControl.OnSelectedValueChanged(EventArgs e)
   at System.Windows.Forms.ListBox.OnSelectedValueChanged(EventArgs e)
   at System.Windows.Forms.ListBox.OnSelectedIndexChanged(EventArgs e)
   at System.Windows.Forms.ListBox.WmReflectCommand(Message& m)
   at System.Windows.Forms.ListBox.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


I do not have any values input for 1/2 hour rainfall rate.

Any ideas?

Chris Hickey

unread,
Sep 16, 2013, 11:16:46 AM9/16/13
to arc...@googlegroups.com
The .wgn table is still being 'built' as says in the dialogue box with the in/complete tables.  How long should this all take?

Emad M

unread,
May 7, 2016, 1:33:13 AM5/7/16
to ArcSWAT
Hi Chris

I'm having the same problem.
I'm stuck on this step.
Could I possibly ask you a favor to guide me through this issue?!

Emad
photo_2016-05-06_22-30-08.jpg

hamish.p...@googlemail.com

unread,
Jul 15, 2016, 8:57:24 AM7/15/16
to ArcSWAT
Chris, I had the "Syntax Error in INSERT INTO statement: IN, mWriteInputFiles.wgn" error and it turned out to be because I had blank fields in the WGN_user table in SWAT2012.mdb (I'd imported this table from the output created by WGNmaker4.1.xls). The solution was to replace the blank fields with -99.

Neliswa Pretty

unread,
Nov 15, 2018, 2:17:15 AM11/15/18
to ArcSWAT
I have the same problem were you able to solve it using the -99.0 because for me it still does not work

ayfer ozdemir

unread,
Nov 9, 2022, 3:56:20 AM11/9/22
to ArcSWAT
Hello,

I have the same problem, Could you solve this problem

16 Eylül 2013 Pazartesi tarihinde saat 17:33:02 UTC+3 itibarıyla ahokie...@gmail.com şunları yazdı:

Aishu Abi

unread,
Nov 18, 2022, 1:23:40 AM11/18/22
to ArcSWAT
Hai everyone!!! I did face the same issue. So I went and checked my database. There were no blank fields. But still, I face the same issue. Can someone help me?

Zayd A Dagari

unread,
Apr 14, 2023, 12:29:27 PM4/14/23
to ArcSWAT
Alhamdulillah! I had thesame problem and your solution worked perfectly. thnks

IMUWAHEN AIGBEDION

unread,
Jul 2, 2025, 9:24:32 AMJul 2
to ArcSWAT
Please what is the solution for this error.
Please share.
Imuwahen

IMUWAHEN AIGBEDION

unread,
Jul 3, 2025, 9:49:05 AMJul 3
to ArcSWAT
Yeah, solution to this error
Reply all
Reply to author
Forward
0 new messages