Parameter object is improperly defined?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Tourless
Pro Scripter
Posts: 69
Joined: Wed Jun 14, 2017 1:53 am
Location: NY

Parameter object is improperly defined?

Post by Tourless » Thu Apr 20, 2023 6:08 pm

Hi Folks.

I'm fairly certain I'm having a syntax issue but can't put my finger on it and I'm having a hard time finding examples . I'm simply connecting to a db and trying to insert some data. This is my first attempt at working with a db from MS and while it doesn't seem too difficult, I can't get over this hump. Any ideas?

The full error reads...

Parameter object is improperly defined. Inconsistent or incomplete information was provided.

Code: Select all

Let>uid=1
Let>plant=2
Let>machine=2CBW1
GetTime>timestamp
Let>isonline=1
Let>transfers=100
Let>runtime=3.5
Let>holdtime=.5
Let>runtbt=2.5
Let>lasttbt=1.75

DBConnect>Provider=SQLOLEDB.1;Password=yohohoandabottleofrum;Persist Security Info=True;User ID=sa;Initial Catalog=db;Data Source=dbSQL,dbH

Let>tmp1=INSERT INTO db (uid, plant, machine, timestamp, isonline, transfers, runtime, holdtime, runtbt, lasttbt) VALUES (%uid%, %plant%, %machine%, %timestamp%, %isonline%, %transfers%, %runtime%, %holdtime%, %runtbt%, %lasttbt%)
DBExec>dbH,tmp1,rowsAffected

User avatar
JRL
Automation Wizard
Posts: 3524
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Parameter object is improperly defined?

Post by JRL » Thu Apr 20, 2023 6:36 pm

Assuming your connection string is correct I don't notice any glaring flaws. Databases are finicky though. One thing I know that might be required are apostrophes or possibly quotes around the values.
VALUES ('%uid%', '%plant%', '%machine%', '%timestamp%', '%isonline%', '%transfers%', '%runtime%', '%holdtime%', '%runtbt%', '%lasttbt%')
Another thing is the header names might be case sensitive.

Also you may have it and just left it out of the posting but DO NOT forget to close the connection. Last line should be:
DBClose>dbH

Tourless
Pro Scripter
Posts: 69
Joined: Wed Jun 14, 2017 1:53 am
Location: NY

Re: Parameter object is improperly defined?

Post by Tourless » Thu Apr 20, 2023 7:10 pm

Thanks JR, you're right on the money... '%variable%' is the way to solve that problem! And yeah, I cloed my DBClose off when copying my code, my bad.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts