Home > Net >  Winform EXCEL data import access inline contain special characters
Winform EXCEL data import access inline contain special characters

Time:01-19

Due to some data have special characters inside, cause the failure of import, this how to solve?
Now there is data line is this:
Dashang group/new smart - anshan head office/traditional Chinese famous brand pavilion/cosmetics/ADOPT 1 f 'perfume



 
The DataTable exdtc=xslcdata ();
OleDbCommand deletecmd7=new OleDbCommand (" delete from table "oversold box, conn);
Deletecmd7. ExecuteNonQuery ();
for (int i=0; I & lt; Exdtc. Rows. Count; I++)
{
String z=exdtc. Rows [I] [3]. The ToString ();

String KTS=exdtc. Rows [I] [4]. The ToString ();

If (yz!="")
{
OleDbCommand insertcmd7=new OleDbCommand (" insert into oversold box table + "
"State) (megabite box, box" +
"Values ('" + z + "', '" + KTS +") ", conn);
Insertcmd7. ExecuteNonQuery ();
}
}
Conn. Close ();

break;

CodePudding user response:

SQL statement has single quotation marks to use two single quotes instead of a single quotes (essentially that's the case, the access you try)

CodePudding user response:

C # can I pass it to escape into a string

CodePudding user response:

Use don't their stitching parameters

CodePudding user response:

the need to pass the value of the parametric!

CodePudding user response:

SQL to participate, to assemble with StringBuffer spell ah,
  •  Tags:  
  • C#
  • Related