|
|
|
start date: Thu, 16 Aug 2007 22:29:47 -0700,
posted on: microsoft.public.dotnet.framework.adonet
back
| Thread Index |
|
1
unknown
|
|
2
Cor Ligthert [MVP]
|
|
3
unknown
|
Problem while filling the dataset where the data source is a .CSV file
HI,
I am trying to reading a .csv file from a remote desktop.
the connection string that i am using is as follows:
strConn = "Provider=MS Remote;"+"Remote Server=//<ComputerName>/
<FolederName>;" + " Remote Provider=Microsoft.Jet.OLEDB.4.0;"+"Data
Source="+@"d:/trial/try1.csv"+";"+"Extended
Properties='text;HDR=Yes;FMT=Delimited'";
With this connection string i am able to open the connection but when
i try to fill the data set it gives me the error:
"Specified Cast is not valid"
the line is
da.Fill(ds);
where 'da' is the OleDbDataAdapter and 'ds' is the dataset
The complete Block of code is as follows:
string strConn;
OleDbConnection conn ;
OleDbDataAdapter da;
strConn = "Provider=MS Remote;"+"Remote Server=//ind-spz4dxp612/
trial;" + " Remote Provider=Microsoft.Jet.OLEDB.4.0;"+"Data
Source="+@"d:/trial/try1.csv"+";"+"Extended
Properties='text;HDR=Yes;FMT=Delimited'";
conn = new OleDbConnection(strConn);
da = new OleDbDataAdapter("SELECT * FROM [TRY1.CSV]",conn);
da.Fill(ds);========== This Is The line which gives this error.
Your help and inputs will be appreciated.
Thanks.
Date:Thu, 16 Aug 2007 22:29:47 -0700
Author:
|
Re: Problem while filling the dataset where the data source is a .CSV file
Hi Simran,
Have a look what Paul has written about your question, this is a selection
on this topic he has in my idea at least given thousand answers.
http://groups.google.nl/group/microsoft.public.dotnet.framework.adonet/search?group=microsoft.public.dotnet.framework.adonet&q=Excel+Clement+hdr&qt_g=Zoeken+in+deze+groep
Cor
schreef in bericht
news:1187328587.537153.246020@d55g2000hsg.googlegroups.com...
> HI,
> I am trying to reading a .csv file from a remote desktop.
>
> the connection string that i am using is as follows:
>
> strConn = "Provider=MS Remote;"+"Remote Server=//<ComputerName>/
> <FolederName>;" + " Remote Provider=Microsoft.Jet.OLEDB.4.0;"+"Data
> Source="+@"d:/trial/try1.csv"+";"+"Extended
> Properties='text;HDR=Yes;FMT=Delimited'";
>
> With this connection string i am able to open the connection but when
> i try to fill the data set it gives me the error:
>
> "Specified Cast is not valid"
>
> the line is
>
> da.Fill(ds);
>
> where 'da' is the OleDbDataAdapter and 'ds' is the dataset
>
> The complete Block of code is as follows:
>
> string strConn;
> OleDbConnection conn ;
> OleDbDataAdapter da;
>
> strConn = "Provider=MS Remote;"+"Remote Server=//ind-spz4dxp612/
> trial;" + " Remote Provider=Microsoft.Jet.OLEDB.4.0;"+"Data
> Source="+@"d:/trial/try1.csv"+";"+"Extended
> Properties='text;HDR=Yes;FMT=Delimited'";
>
> conn = new OleDbConnection(strConn);
> da = new OleDbDataAdapter("SELECT * FROM [TRY1.CSV]",conn);
> da.Fill(ds);========== This Is The line which gives this error.
>
> Your help and inputs will be appreciated.
> Thanks.
>
Date:Fri, 17 Aug 2007 14:52:26 +0200
Author:
|
Re: Problem while filling the dataset where the data source is a .CSV file
Thank you so much for your reply.
i went thru the link provided but couldnt find helpk relavant to my
issue.........
also i would like add some more information to the same........
hope i can find some more help........
i would also like to bring to your note dat i m using an impersonated
user (programatically)
there are two cases:
one:
if i include the <identity impersonate="true"> in web config
and use the following string
strConnA = "Provider=MS Remote;"+"Remote Server="+@"\\<comp name>
\<foleder name>;" + " Remote Provider=Microsoft.Jet.OLEDB.4.0;"+"Data
Source="+"try1.csv"+";"+"Extended
Properties='text;HDR=Yes;FMT=Delimited'";
i get the error "MS remote is not registered in the local machine"
and if i use the following string
strConnB ="Provider=Microsoft.Jet.Oledb.4.0;"+"Data Source="+"\\<comp
name>\<foleder name>;"+"Extended
Properties='text;HDR=Yes;FMT=Delimited'";
i get the error " Microsoft.Jet.Oledb.4.0 is not registered in the
local machine"
whereas Microsoft jet with the latesh version is available on my
machine (win XP)
and the second is
if i set <identity impersonate="false"> then with
the strConnA i get the error "specified cast is not valid"
and with strConnB i get "Unspecified error"
i m really not sure which is the right path dat i should go ahead with
there being so many option
it would be really helpful if you could tell me wut would ideally be
the right path(i mean whc string should i use and should i set the
idedntity to true o not)
i really need this.have been racking my head since quite some time now
on this
plz do help
thanx
Cor Ligthert [MVP] wrote:
> Hi Simran,
>
> Have a look what Paul has written about your question, this is a selection
> on this topic he has in my idea at least given thousand answers.
>
> http://groups.google.nl/group/microsoft.public.dotnet.framework.adonet/search?group=microsoft.public.dotnet.framework.adonet&q=Excel+Clement+hdr&qt_g=Zoeken+in+deze+groep
>
>
Date:Sun, 19 Aug 2007 22:25:01 -0700
Author:
|
|
|