Home > php教程 > php手册 > C# 一些简单算法

C# 一些简单算法

WBOY
Release: 2016-06-06 20:01:28
Original
1274 people have browsed it

//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 =

     //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;
    }


 ///


 /// 字符串过滤
 ///

 /// 传来参数
 /// 过滤后的字符串
 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;
 }

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template