Click here to Skip to main content
15,918,258 members
Home / Discussions / C#
   

C#

 
GeneralRe: Weird problem... Pin
Support1236-Nov-06 4:38
Support1236-Nov-06 4:38 
GeneralRe: Weird problem... Pin
Pete O'Hanlon6-Nov-06 4:48
mvePete O'Hanlon6-Nov-06 4:48 
GeneralRe: Weird problem... Pin
Support1236-Nov-06 4:52
Support1236-Nov-06 4:52 
GeneralRe: Weird problem... Pin
eggsovereasy6-Nov-06 5:47
eggsovereasy6-Nov-06 5:47 
GeneralRe: Weird problem... Pin
Support1236-Nov-06 21:51
Support1236-Nov-06 21:51 
QuestionC# (Windows Forms) to HTML to PDF Pin
davehoonter6-Nov-06 3:49
davehoonter6-Nov-06 3:49 
AnswerRe: C# (Windows Forms) to HTML to PDF Pin
Christopher Duncan7-Nov-06 3:25
Christopher Duncan7-Nov-06 3:25 
Questionexcel .NET 2.0 Pin
fmardani6-Nov-06 3:30
fmardani6-Nov-06 3:30 
Hi,
Trying to read the data from an excel spreadsheet in C# 2005, but there is an error as follows:
The Microsoft Jet database engine could not find the object 'Cities$'. Make sure the object exists and that you spell its name and the path name correctly.

The excel speadsheet is placed in the same place as Program.cs and the sheet name is indeed cities.

This is the code:

private void btnExcel_Click(object sender, EventArgs e)
{
string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Book1.xls;Extended Properties=""Excel 8.0;HDR=YES;""";

DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.OleDb");

using (DbConnection connection = factory.CreateConnection())
{
connection.ConnectionString = connectionString;

using (DbCommand command = connection.CreateCommand())
{
// Cities$ comes from the name of the worksheet
command.CommandText = "SELECT ID,City,State FROM [Cities$]";

connection.Open();

using (DbDataReader dr = command.ExecuteReader()) //fails here...
{
while (dr.Read())
{
Console.WriteLine(dr["ID"].ToString());
}
}
}
}

}
AnswerRe: excel .NET 2.0 Pin
ednrgc6-Nov-06 3:44
ednrgc6-Nov-06 3:44 
GeneralRe: excel .NET 2.0 Pin
fmardani6-Nov-06 4:12
fmardani6-Nov-06 4:12 
AnswerRe: excel .NET 2.0 Pin
Eric Dahlvang6-Nov-06 6:31
Eric Dahlvang6-Nov-06 6:31 
QuestionQueue for Serialport communication... Pin
IamHuM6-Nov-06 3:28
IamHuM6-Nov-06 3:28 
QuestionDirectShow Pin
stricher_086-Nov-06 3:25
stricher_086-Nov-06 3:25 
AnswerRe: DirectShow Pin
Jon Hulatt7-Nov-06 0:58
Jon Hulatt7-Nov-06 0:58 
QuestionHow to generate a random string Pin
CodeItWell6-Nov-06 3:21
CodeItWell6-Nov-06 3:21 
AnswerRe: How to generate a random string Pin
Andrew Rissing6-Nov-06 3:32
Andrew Rissing6-Nov-06 3:32 
AnswerRe: How to generate a random string Pin
V.6-Nov-06 3:35
professionalV.6-Nov-06 3:35 
AnswerRe: How to generate a random string Pin
ednrgc6-Nov-06 4:11
ednrgc6-Nov-06 4:11 
QuestionFinding shared folders across network ? Pin
AmitDey6-Nov-06 2:07
AmitDey6-Nov-06 2:07 
QuestionOnMouseWheel not fired in Control derived class in splittercontainer Pin
Jon Hulatt6-Nov-06 2:01
Jon Hulatt6-Nov-06 2:01 
AnswerRe: OnMouseWheel not fired in Control derived class in splittercontainer Pin
sam#6-Nov-06 2:58
sam#6-Nov-06 2:58 
GeneralRe: OnMouseWheel not fired in Control derived class in splittercontainer Pin
Jon Hulatt6-Nov-06 3:51
Jon Hulatt6-Nov-06 3:51 
QuestionJIT Error Pin
kulile6-Nov-06 1:39
kulile6-Nov-06 1:39 
AnswerRe: JIT Error Pin
Obaid ur Rehman6-Nov-06 2:49
Obaid ur Rehman6-Nov-06 2:49 
GeneralRe: JIT Error Pin
kulile6-Nov-06 3:49
kulile6-Nov-06 3:49 

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.