Re: Accessing text / csv files using ADO in C++
- From: "Ralph" <nt_consulting64@xxxxxxxxx>
- Date: Mon, 3 Mar 2008 09:48:49 -0600
"Venkatesh" <Venkatesh@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:BDA5F613-C960-454F-AD1B-D95B66AC9422@xxxxxxxxxxxxxxxx
ADO may not be the best way of accessing data when developing in C++, yetcan
somebody tell me how to access a csv file (comma-separated values) usingADO
in C++. The following code gives me an error "Invalid pointer" when I call
the Open method of the ADO Connection object.
_ConnectionPtr spConn;
spConn.CreateInstance(__uuidof(Connection));
spConn->Open(L"Driver={Microsoft Text Driver (*.txt;
*.csv)};Dbq=C:\\;Extensions=csv,txt;", _bstr_t(L""), _bstr_t(L""),
adConnectUnspecified );
I get the same error even when Open() is called like this:
spConn->Open(L"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\;Extended
Properties=\"text;HDR=YES;FMT=Delimited(,)\"", _bstr_t(L""), _bstr_t(L""),
adConnectUnspecified );
I actually got these two variants for Open() from some VB samples, so I
don't know if I can use that way here. Of course, in VB, the last three
parameters to Open() are optional, so I passed blank values etc here.
try
_ConnectionPtr spConn(__uuidof(Connection));
You are trying to call a method on an uninitialized object.
After you have a Connection object you can use the Errors Collection to
deliminate additional problems.
-ralph
.
- Follow-Ups:
- Re: Accessing text / csv files using ADO in C++
- From: Venkatesh
- Re: Accessing text / csv files using ADO in C++
- Prev by Date: Re: Roles and user from my own DB
- Next by Date: Re: Accessing text / csv files using ADO in C++
- Previous by thread: Re: Roles and user from my own DB
- Next by thread: Re: Accessing text / csv files using ADO in C++
- Index(es):
Relevant Pages
|
|