LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ADO Error: 0x00000001 Argument error; the number of columns does not equal the number of parameters.

Hello,

 

I am new on Databases, So I want to insert 15 datas (Values, Strings, Dates, T/F...) and I have a Database with 15 columns, I have the name of the 15 Columns, the name of the Table, the DSN name, etc...

 

I really don't see where is the problem, but I have seen that the error is everytime the same if I change table name and take a none-existing table name...

Maybe it is a problem about the date? It is the date of the "execution test". In the database the format is "Date/Time" and in my VI I have chosen a String, not a numerical constant.

 

The error message make no sense because I have the same number of columns and parameters: 15.

 

- Here is my VI, it is one sub-VI of my main VI.

 

Tell me if you need more informations.

 

Best resgards,

Robin.

 

0 Kudos
Message 1 of 10
(6,339 Views)

Hello,

 

In ODBC Data Source Administrator, when you create a System DSN, you need the "attach database filename" to connect to the database? If yes my problem is here, but I did not create the database so I do not know where can I find the attach database filename?

 

Any help will be usefull.

 

Best regards,

Robin.

0 Kudos
Message 2 of 10
(6,297 Views)

You're using the insert VI incorrectly. You need to call it once (because you're inserting a single row) and give it the list of columns and a cluster with one element for each column. Read the help for it and look at the examples.


___________________
Try to take over the world!
Message 3 of 10
(6,294 Views)

Hello,

 

Thanks for your answer it was really useful! I did not noticed that we have to call it once! Now this error is fixed, got this one:

 

ADO Error: 0x80040E37
Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'Tests.Step1.PowerSupplies'.

 

Probably because I do not have the "Attach database filename" then it is not looking at the good database so it can not see the table. Am I right?

0 Kudos
Message 4 of 10
(6,290 Views)

My guess would be that there is no table with that name in the DB (I'm not even sure periods are legal in table names), but it's hard to tell without debugging. It's also weird that the driver is described as SQL Server while your connection string is supposedly for Access, which presumably means a Jet DB. You can debug to see where you get the error.

 

I would also suggest learning more about DBs. Here's an example of a blog with some posts and there are certainly other resources too - http://www.notatamelion.com/2015/01/05/managing-data-the-easy-way/


___________________
Try to take over the world!
0 Kudos
Message 5 of 10
(6,283 Views)

There is this table in my Database, I create the table with someone else, and we have named the table like that, when I open the Database in Excel I can see it is in the right server, the good database and I can read the table, its name on Excel is "Tests Step1 PowerSupplies".

 

My job is to communicate with the database, first I just want to insert datas. It is SQL server the MS Access2 is just the name of the SQL Server. I can't use it like that?

 

 

Here are some screen shot,1st pic is where it ask the "Attach database filename" that's what I am talking about, how to find this?

 

The 2nd pic is how is running actually the system DSN, and we can see it communicate with Server but not with Database, even if it has name.

 

So I really need that Attach database filename right?

Download All
0 Kudos
Message 6 of 10
(6,279 Views)

Personally I use UDL files to configure access to a DB and then just give the UDL file path to the open function, because UDL files let you change the connection string easily (double clicking them opens a wizard for configuring and testing the connection). I would suggest that.

 

Other than that, I would suggest not using periods in table names because periods are used as delimiters to indicate columns in tables, so it could be confusing, or possibly not even work. Spaces are also generally not a good idea, although you can use square brackets to identify tables or columns which have them.


___________________
Try to take over the world!
0 Kudos
Message 7 of 10
(6,270 Views)

Hello, well I am in internship that's the method I have to use, I absolutely don't know where and why I am stuck... I had never used debugg functions in LabVIEW, because I never had this time of problem... That's really annoying to don't know where it fail because the error message is saying something that is not right, but when I test the system DSN in ODBC data source it say that the test work... I can not see where is exactly the problem? If yes why? someone had this problem and solve it? I did not saw any post of that error in the ni.forum.

0 Kudos
Message 8 of 10
(6,239 Views)

Hello, my problem was because "." is a special character so you need "" to specify the table or columns with special characters. So it's resolved, btw I have a last question:

 

I want to place 14 datas in the table, the 1st is auto set by the database. What do I have to do? I can't say "start to column 1 and not to column 0"?  or "If there is something in this column then don't touch hit"? Blank or void constant don't work.

 

0 Kudos
Message 9 of 10
(6,219 Views)
For future reference, you can also use illegal characters by including the names is square brackets like so:

[Tests.Step1.PowerSupplies]

Of course this can make the code messy, so changing the name is the preferred solution.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 10 of 10
(6,213 Views)