Click here to Skip to main content
15,887,410 members
Home / Discussions / C#
   

C#

 
AnswerRe: Byte to Bits String Pin
Guffa16-Jul-08 20:56
Guffa16-Jul-08 20:56 
GeneralRe: Byte to Bits String Pin
half-life16-Jul-08 21:02
half-life16-Jul-08 21:02 
GeneralRe: Byte to Bits String Pin
leppie17-Jul-08 2:08
leppie17-Jul-08 2:08 
GeneralRe: Byte to Bits String Pin
PIEBALDconsult17-Jul-08 5:09
mvePIEBALDconsult17-Jul-08 5:09 
GeneralRe: Byte to Bits String Pin
Guffa17-Jul-08 7:19
Guffa17-Jul-08 7:19 
GeneralRe: Byte to Bits String Pin
PIEBALDconsult17-Jul-08 14:58
mvePIEBALDconsult17-Jul-08 14:58 
AnswerRe: Byte to Bits String Pin
PIEBALDconsult17-Jul-08 5:19
mvePIEBALDconsult17-Jul-08 5:19 
QuestionOLEDB with Excel problem Pin
acroitoriu16-Jul-08 20:18
acroitoriu16-Jul-08 20:18 
Hi,

I have a simple method that checks if a sheet name is present in the excel file or not. The code is simple and works fine when the sheet name doesn't contain any spaces:

private bool validateExcelSheetByName(string name, OleDbConnection connection) {
bool result = true;
try {
if (connection.State == ConnectionState.Closed)
connection.Open();
var command = new OleDbCommand(string.Format("select * from [{0}]", name), connection);
command.ExecuteNonQuery();
}
catch {
result = false;
if (connection.State == ConnectionState.Open)
connection.Close();
}
return result;
}

In case I have a dot and a space in the sheet name (for example 'My. Sheet'), I get an exception saying:
Invalid bracketing of name 'My. Sheet$'.

I store the sheet name in a variable:
private const string sheetName = "My. Sheet$";

How can I fix this code so it will work when I have dots and spaces in the sheet name?

Thank you!

Andrei
AnswerRe: OLEDB with Excel problem Pin
dan!sh 16-Jul-08 20:44
professional dan!sh 16-Jul-08 20:44 
GeneralRe: OLEDB with Excel problem Pin
acroitoriu17-Jul-08 21:41
acroitoriu17-Jul-08 21:41 
Questionusing a variable on two different forms Pin
programming.student16-Jul-08 19:04
programming.student16-Jul-08 19:04 
AnswerRe: using a variable on two different forms Pin
N a v a n e e t h16-Jul-08 19:52
N a v a n e e t h16-Jul-08 19:52 
GeneralRe: using a variable on two different forms Pin
programming.student16-Jul-08 20:15
programming.student16-Jul-08 20:15 
GeneralRe: using a variable on two different forms Pin
Alex@UEA16-Jul-08 23:45
Alex@UEA16-Jul-08 23:45 
AnswerRe: using a variable on two different forms Pin
Ajay.k_Singh16-Jul-08 20:22
Ajay.k_Singh16-Jul-08 20:22 
GeneralRe: using a variable on two different forms Pin
V.16-Jul-08 21:48
professionalV.16-Jul-08 21:48 
QuestionListView problem ! [modified] Pin
itmad16-Jul-08 18:47
itmad16-Jul-08 18:47 
AnswerRe: ListView problem ! Pin
Ravi Bhavnani16-Jul-08 18:55
professionalRavi Bhavnani16-Jul-08 18:55 
AnswerRe: ListView problem ! [modified] Pin
itmad16-Jul-08 21:14
itmad16-Jul-08 21:14 
QuestionHi all...problem in retrining more then 1200 records from DB2 Pin
tasumisra16-Jul-08 18:38
tasumisra16-Jul-08 18:38 
QuestionRe: Hi all...problem in retrining more then 1200 records from DB2 Pin
tasumisra16-Jul-08 19:07
tasumisra16-Jul-08 19:07 
Questionhow write a addon tool for Internet Explorer ????? Pin
San@Coding16-Jul-08 18:08
San@Coding16-Jul-08 18:08 
QuestionEncryption Pin
ctrlnick16-Jul-08 13:00
ctrlnick16-Jul-08 13:00 
AnswerRe: Encryption Pin
Judah Gabriel Himango16-Jul-08 14:14
sponsorJudah Gabriel Himango16-Jul-08 14:14 
QuestionEasy Question Pin
nelsonpaixao16-Jul-08 12:54
nelsonpaixao16-Jul-08 12:54 

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.