Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / January 2007



Tip: Looking for answers? Try searching our database.

Yet another "No value given for one or more required parameters"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tomg - 29 Jan 2007 22:39 GMT
Given a CSV file in C:\DATA\ALL.csv that starts as follows:
"Object Short Text","Object Level","Created By","Last Modified By","Object
Text","Object Number","Created On","Last Modified On","Object
Identifier","UCorUCS","Object Heading","Absolute Number","Created Thru"
,1,"xyz","abc","Data",1,"8/27/2001","1/16/2006","XT-EOU-ACTMGR-88",,"Introduction",88,"Manual Input"
,2,"xyz","abc",,"1.1","8/27/2001","9/11/2002","XT-EOU-ACTMGR-89",,"Actors",89,"Manual Input"

The code...
       Dim rs As ADODB.Recordset
       rs = New ADODB.Recordset
       Dim conn As ADODB.Connection
       conn = New ADODB.Connection
       Dim DirectoryName = "C:\DATA\"
       conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
DirectoryName & ";Extended Properties=""text;HDR=YES;FMT=CSVDelimited""")
       rs.Open("select [Object Identifier] from [ALL.csv]", conn,
ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly)

Gives the **classic** error "No value given for one or more required
parameters"

The SQL statement:
       rs.Open("select * from [ALL.csv]", conn,
ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly)\\

Returns all 22736 rows the top two of which are shown above.

I'm using Visual Studio 2005 (8.0.50727.42) with .NET framework 2.0.50727
and Visual Basic 2005.

This same code worked under Visual Basic 6.

What could be causing the problem with the failing SQL select statement?  
The select all fields version shows that the file is being read in its
entirety (should not be a permission problem and the file is available.)  I
do get the idea that it does not like the column names.  When the entire
table is read with all fields the 0th record is the first data record.  I
hope I'm just missing something very simple.

Thanks.
Argusy - 30 Jan 2007 00:47 GMT
I'm not sure if I'm seeing correctly, but shouldn't your file be added
to DirectoryName?
ie 'conn.open ( <blah>.. DirectoryName & file & ";Extended... <blah>)

I've always included the filename, but I don't know if dotnet is different
(I'm a straight VB6 user, not into dotnet at all)

Argusy

> Given a CSV file in C:\DATA\ALL.csv that starts as follows:
> "Object Short Text","Object Level","Created By","Last Modified By","Object
[quoted text clipped - 12 lines]
> DirectoryName & ";Extended Properties=""text;HDR=YES;FMT=CSVDelimited""")
>         rs.Open("select [Object Identifier] from [ALL.csv]", conn,
<snip>
tomg - 30 Jan 2007 02:09 GMT
I figured out the problem.  The header line has quotes around the column
headers.  When I removed the quotation marks the SQL statement was accepted.  
IMHO, that's a bug.  Anyway, at least a solution is in sight.

> I'm not sure if I'm seeing correctly, but shouldn't your file be added
> to DirectoryName?
[quoted text clipped - 22 lines]
> >         rs.Open("select [Object Identifier] from [ALL.csv]", conn,
> <snip>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.