0

I am trying to retrieve some info from a csv file by doing a request to it but I keep having this error: No value given for one or more required parameters, Code 80040E10 Source: Microsoft JET Database Engine

It concerns the following line of my script:

RECORDSET.Open "SELECT * FROM " & strFile & " WHERE ComputerName = '" & OldComputerName & "'", CONNECTION, 3, 3

But if I do a wscript.echo of the strFile and OldComputerName right before the request, they display the right values.

Here is the whole part of the script with the request:

dim CONNECTION : set CONNECTION = CreateObject("ADODB.CONNECTION")
dim RECORDSET : set RECORDSET = CreateObject("ADODB.RECORDSET")
CONNECTION.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\contoso.scom\DP_IT\Rollout\;Extended Properties=""text;HDR=YES;FMT=Delimited"""
strFile = "[CONTOSO-OPR-ComputerList.csv]" 
wscript.echo strfile
wscript.echo OldComputerNameenter 
RECORDSET.Open "SELECT * FROM " & strFile & " WHERE ComputerName = '" & OldComputerName & "'", CONNECTION, 3, 3

I would like to tell that this worked before. I haven't touch it for some weeks but it appears that something has changed and I don't know what :/

EDIT: If I do a wscript.echo of the entire request it gives me this:

SELECT * FROM [CONTOSO-OPR-ComputerList.csv] WHERE ComputerName = 'ABC123'

Jota
  • 17,281
  • 7
  • 63
  • 93
Wawa41
  • 51
  • 1
  • 1
  • 7
  • is there definitely a field called `ComputerName`? –  Apr 19 '12 at 15:09
  • Yes there is one field called like this – Wawa41 Apr 23 '12 at 11:19
  • Well after a couple of checks I found that the script works perfectly fine on a regular XP installation but does not work on the master of my client. In the same condition (network, shares, rights...) Is there something they could have done to prevent it to work correctly ? – Wawa41 Apr 23 '12 at 12:03

1 Answers1

0

As user69820's comment indicates, the most likely cause for that error wrt to simple SQL statements is a bad column name. Assuming "same condition (network, shares, rights...)" (tall order, I admit), the next suspect in my opinion is (different) Regional Settings determining the field separator.

Given German Settings (i.e. ";" separator), a file with "," like

ComputerName,WhatEver
"ABC123",1
"DEF456",2

will cause the error, while

ComputerName;WhatEver
"ABC123";1
"DEF456";2

will 'work' with no problems.

Ekkehard.Horner
  • 38,498
  • 2
  • 45
  • 96