I am running oracle query and getting the data storing it in dataset(dsDataSet)
STEP 2 :Copying it to datatable.
dtAEDetails= dsDataSet.Tables[0].Copy();)
Step 3 : storing the datatable into access database.
I am having issue in datatable, one field Desc1 in datatable having single quote(ex:
'SCHOLAR'S EDGE THE AGGR P'
The below code is inserting datatable into access database.
if datatable rows >0 then inserting into access database.
DESC1 field is having single quote , how to replace single quote with double quote before insert into database.
if (dtAEDetails.Rows.Count > 0)
{
foreach (DataRow drAEDetails in dtAEDetails.Rows)
{
sInsertValues =
"'" + drAEDetails["OFFICE"].ToString() + "','"
+ drAEDetails["AE"].ToString() + "','"<pre> if (dtAEDetails.Rows.Count > 0)
{
foreach (DataRow drAEDetails in dtAEDetails.Rows)
{
sInsertValues =
"'" + drAEDetails["OFFICE"].ToString() + "','"
+ drAEDetails["AE"].ToString() + "','"
+ drAEDetails["SETDATE"].ToString() + "','"
+ drAEDetails["ACCT"].ToString() + "','"
+ drAEDetails["SHORT"].ToString() + "','"
+ drAEDetails["BS"].ToString() + "','"
+ drAEDetails["SHARES"].ToString() + "','"
+ drAEDetails["DESC1"].ToString()+ "','"
+ drAEDetails["PRICE"].ToString() + "','"
+ drAEDetails["PRINC"].ToString() + "','"
+ drAEDetails["GROSS"].ToString() + "','"
+ drAEDetails["STAND"].ToString() + "','"
+ drAEDetails["NET"].ToString() + "','"
+ drAEDetails["NEWNET"].ToString() + "','"
+ drAEDetails["AECHG"].ToString()+ "','"
+ drAEDetails["BONUS"].ToString()+ "','"
+ drAEDetails["BT"].ToString() + "','"
+ drAEDetails["CANCEL"].ToString() + "','"
+ drAEDetails["TRANSCODE"].ToString() + "','"
+ drAEDetails["ORDERSORT"].ToString() + "','"
+ drAEDetails["REALGR"].ToString() + "','"
+ drAEDetails["ANNUITYNET"].ToString() + "','"
+ drAEDetails["RECORDID"].ToString() + "','"
+ drAEDetails["USER_CODE_1"].ToString() + "','"
+ drAEDetails["USER_CODE_7"].ToString() + "'";
insertAEdetails.ParmValue = sInsertValues;
insertAEdetails.InsertIntoAccess();
how to replace single quote into double quote in desc field and store it to dataset, after replacing I want to store it into datatable . how to do it.
Please guide me.
Thanks
What I have tried:
I thought of replacing in query , but my colegue said it's easy in code.
can you please give me idea.