Extends) +; ExtendedPropertiesExcel8.0; OleDbConnectionolecon
// Import the private DataSet CreateDataSource () {string strCon; strCon = "Provider = Microsoft. jet. OLEDB.4.0; Data Source = "+ Server. mapPath ("/net_admin/exportcj/excel.xls") + "; Extended Properties = Excel 8.0;"; OleDbConnection olecon =
// Import the database in Excel
Private DataSet CreateDataSource ()
{
String strCon;
StrCon = "Provider = Microsoft. Jet. OLEDB.4.0; Data Source =" + Server. MapPath ("/net_admin/exportcj/excel.xls") + "; Extended Properties = Excel 8.0 ;";
OleDbConnection olecon = new OleDbConnection (strCon );
OleDbDataAdapter myda = new OleDbDataAdapter ("SELECT * FROM [Sheet1 $]", strCon );
DataSet myds = new DataSet ();
Myda. Fill (myds );
Return myds;
}
///
/// String Filtering
///
/// Transmit Parameters
/// Filtered string
Public string FilterStr (string strvalue)
{
String strfilter = "; | % | * | and | exec | insert | select | delete | update | count | chr | mid | master | truncate | char | declare | script ";
String [] strfil = strfilter. Split ('| ');
Foreach (string str in strfil)
{
Strvalue = strvalue. Replace (str ,"");
}
Return strvalue;
}