LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel with OLEDB and Ado.Net - Single quote problem(')


Hello,

I am trying to create a simple excel (xls) table , when creating the table I
get a ' (single quote) prefix before each value ,

how can I get rid of this single quote it is messing up my numbers with
format errors !!!



The Code I used:

public bool InsertHeader(string TitleCode, string OrderNum, string HHNum,
string StartDate, string EndDate)
{
string insertQuery = "Create Table Sheet1 ({0} String, {1}
String, {2} String, [{3}] String, [{4}] String)";

ExecuteQuery(string.Format(insertQuery, TitleCode, OrderNum,
HHNum, StartDate, EndDate));
return true;
}


public bool InsertRow(string RowCode, string ChapterStr, string
Num1, string Num2)
{
string insertQuery = "INSERT INTO [Sheet1$A:D] values
({0},'{1}',{2},{3})";
ExecuteQuery(string.Format(insertQuery, RowCode, ChapterStr,
Num1, Num2));
return true;
}

private void ExecuteQuery(string Query)
{

CurConnection = new OleDbConnection(ConStr);
string insertQuery = Query;
CurCommand = new OleDbCommand(insertQuery, CurConnection);
CurConnection.Open();
try
{
CurCommand.ExecuteNonQuery();
}
catch (Exception ex)
{

}
finally
{
CurConnection.Close();
}
}



InsertHeader("1","2","x","Y","z");



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read a string in excel and include the single quote Ricky Excel Discussion (Misc queries) 3 September 4th 09 04:46 PM
How can I get rid of the ' single quote in Excel Worksheet Ivan Excel Programming 3 October 21st 05 06:13 AM
How can I get rid of the ' single quote sign in excel worksheet Ivan Excel Worksheet Functions 5 October 21st 05 05:35 AM
adding a single quote and comma to every cell in Excel rodsheffield Excel Programming 3 October 4th 05 08:17 PM
Removing single quote from an excel sheet Hari Excel Discussion (Misc queries) 2 December 3rd 04 09:53 PM


All times are GMT +1. The time now is 03:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"