Click here to Skip to main content
15,899,935 members
Home / Discussions / C#
   

C#

 
QuestionCreation of Wizard to generate C# files Pin
tom groezer16-Jun-06 3:56
tom groezer16-Jun-06 3:56 
QuestionHow to show files in listView Pin
akualopetak16-Jun-06 3:13
akualopetak16-Jun-06 3:13 
AnswerRe: How to show files in listView Pin
Robert Rohde16-Jun-06 3:51
Robert Rohde16-Jun-06 3:51 
Questionproblem with Tab Key & Mouse click Pin
maaran16-Jun-06 2:39
maaran16-Jun-06 2:39 
AnswerRe: problem with Tab Key & Mouse click Pin
aarthi@yahoo.com16-Jun-06 3:08
aarthi@yahoo.com16-Jun-06 3:08 
QuestionUrgent Pin
Shiv516-Jun-06 2:33
Shiv516-Jun-06 2:33 
AnswerRe: Urgent Pin
J4amieC16-Jun-06 3:18
J4amieC16-Jun-06 3:18 
QuestionReading Excel to Dataset Pin
meeram39516-Jun-06 2:09
meeram39516-Jun-06 2:09 
Hi,

I have peculiar problem in reading an excel file to Dataset. That is, I have stored one excel file in my desktop. The same file is stored in my C drive also. While running the application, if the file is from desktop, it is throwing error that " Microsoft Jet Database Engine couldn't open the file....". But if the file is reads from C drive, it is reading correctly. Anybody has any solution for this? Why it is not reading the file from desktop? Following is the code I'm using for reading file:

private void btnReadFile_Click(object sender, System.EventArgs e)
{
string strFilePath;
strFilePath=File1.Value; // I'm using FileField HTML control.
GetDataFromXL(strFilePath);
}

private void GetDataFromXL(string fullfilepath)
{
try
{
string strConnectionString =string.Empty;
int NoofRecords;
strConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+fullfilepath+@";Extended Properties=""Excel 8.0;HDR=YES;""" ;
OleDbConnection cnCSV =new OleDbConnection (strConnectionString);
cnCSV.Open();
lblmessage.Text="File found and opened";
OleDbCommand cmdSelect = new OleDbCommand (@"SELECT * FROM [Sheet1$]", cnCSV);
OleDbDataAdapter daCSV = new OleDbDataAdapter();
daCSV.SelectCommand = cmdSelect;
DataTable dtCSV = new DataTable ();
daCSV.Fill(ds,"IndexesTbl");
NoofRecords=ds.Tables[0].Rows.Count;
}
catch(Exception ex)
{
errMessage=ex.Message;
lblmessage.Text=errMessage;
}
finally
{}

Anybody who knows, please help me. Advance thanks for the same.
Regards

Raja Raman S
Reuters India Pvt.Ltd.
Bangalore
AnswerRe: Reading Excel to Dataset Pin
Eric Dahlvang16-Jun-06 3:16
Eric Dahlvang16-Jun-06 3:16 
GeneralRe: Reading Excel to Dataset Pin
meeram39516-Jun-06 4:37
meeram39516-Jun-06 4:37 
GeneralRe: Reading Excel to Dataset Pin
Eric Dahlvang16-Jun-06 10:01
Eric Dahlvang16-Jun-06 10:01 
QuestionDataGridView scrolling problem Pin
florinp316-Jun-06 2:06
florinp316-Jun-06 2:06 
QuestionDataGridView scrolling problem - details [modified] Pin
florinp320-Jun-06 21:27
florinp320-Jun-06 21:27 
Questioncheck if a class is inherited from another class Pin
hpetriffer16-Jun-06 1:38
hpetriffer16-Jun-06 1:38 
AnswerRe: check if a class is inherited from another class Pin
Daniel Persson16-Jun-06 2:00
Daniel Persson16-Jun-06 2:00 
GeneralRe: check if a class is inherited from another class Pin
hpetriffer16-Jun-06 2:28
hpetriffer16-Jun-06 2:28 
AnswerRe: check if a class is inherited from another class Pin
Guffa16-Jun-06 2:39
Guffa16-Jun-06 2:39 
GeneralRe: check if a class is inherited from another class Pin
hpetriffer18-Jun-06 21:51
hpetriffer18-Jun-06 21:51 
QuestionDirectX video Application Pin
ranandbe16-Jun-06 0:50
ranandbe16-Jun-06 0:50 
QuestionAny way to ensure a selected Datagrid row is visble? Pin
rwestgraham16-Jun-06 0:29
rwestgraham16-Jun-06 0:29 
QuestionRemoving special character from string Pin
yogesh m16-Jun-06 0:19
yogesh m16-Jun-06 0:19 
AnswerRe: Removing special character from string Pin
CWIZO16-Jun-06 1:02
CWIZO16-Jun-06 1:02 
QuestionAbout Mdi Container Pin
relsirc16-Jun-06 0:12
relsirc16-Jun-06 0:12 
AnswerRe: About Mdi Container Pin
rah_sin16-Jun-06 0:25
professionalrah_sin16-Jun-06 0:25 
AnswerRe: About Mdi Container Pin
wasife16-Jun-06 6:00
wasife16-Jun-06 6:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.