Hello I am using excel as my database and when I do an insert there is an apostrophe that appears in the cell where a string was inserted. For example '(474)343-3433
It appears that the apostrophe appears after an insert is done that with a null value.
example
(424)333-3433
'(474)343-3433
'(424)343-3333
thecode:
It appears that the apostrophe appears after an insert is done that with a null value.
example
(424)333-3433
'(474)343-3433
'(424)343-3333
thecode:
Code:
private void WriteToLeadTable() { // Establish a connection to the data source. System.Data.OleDb.OleDbConnection objConn = new System.Data.OleDb.OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + m_strSampleFolder + "LeadConsistencyScorecard.xls;Extended Properties=Excel 8.0;"); objConn.Open(); // Add record System.Data.OleDb.OleDbCommand objCmd = new System.Data.OleDb.OleDbCommand(); objCmd.Connection = objConn; /* The fallowing two fields will not be updated because we do not know what is up * And it is up to the channel manager to know * * Assigned_Date, Assigned_To_Position, Assigned_To_Name," * + "Status, * + "', '" + Fields.Assigned_Date * + "', '" + Fields.Assigned_To_Position + "', '" + Fields.Assigned_To_Name + "', '" + Fields.Status * */ //Write to LeadTable objCmd.CommandText = "INSERT into [Leads$] (Lead_ID, Event_ID, Lead_Comment_ID, Event_Name," + " Received_Date, Lead_Grade," + " Company_Name," +" Street_1," +" Street_2," +" Street_3," + " City," + " State," +" Zip_Code," +" Country," +" Company_Phone," + " Website," + " First_Name," +" Last_Name," +" Job_Title," + " Contact_Phone," + " Phone_Ext," + " Alternate_Phone," +" Email," +" Industry_Vertical)" + " values ('" + Fields.Lead_ID + "', '" + Fields.Event_ID + "', '" + Fields.Lead_Comment_ID + "', '" + Fields.Event_Name + "', '" + Fields.Rainmaker_Date + "', '" + Fields.Lead_Grade + "', '" + Fields.Company_Name + "', '" + Fields.Street_1 + "', '" + Fields.Street_2 + "', '" + Fields.Street_3 + "', '" + Fields.City + "', '" + Fields.State + "', '" + Fields.Zip_Code + "', '" + Fields.Country + "', '" + Fields.Company_Phone + "', '" + Fields.Website + "', '" + Fields.First_Name + "', '" + Fields.Last_Name + "', '" + Fields.Job_Title + "', '" + Fields.Contact_Phone + "', '" + Fields.Phone_Ext + "', '" + Fields.Alternate_Phone + "', '" + Fields.Email + "', '" + Fields.Industry_Vertical + "')"; objCmd.ExecuteNonQuery(); // Close the connection. objConn.Close(); }
Comment