当前位置: 首页>>代码示例>>C#>>正文


C# Reader.DoImport方法代码示例

本文整理汇总了C#中Reader.DoImport方法的典型用法代码示例。如果您正苦于以下问题:C# Reader.DoImport方法的具体用法?C# Reader.DoImport怎么用?C# Reader.DoImport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Reader的用法示例。


在下文中一共展示了Reader.DoImport方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: cmdImport_Click

    protected void cmdImport_Click(object sender, EventArgs e)
    {
        var connection = new SQLServerConnect();
        //for live db
        //connection.SetupConnectionString("Server=MyPetsFW.db.3554730.hostedresource.com;USER ID=MyPetsFW;Password=DevryWeb460;Database=MyPetsFW;Trusted_Connection=False;");

        //for my local db
        //connection.SetupConnectionString("JON/Chris", "", @"Jon\SQLEXPRESS", "MyPetsFW");

        connection.SetupConnectionString("TestUser", "testuser", @"Jon\SQLEXPRESS", "MyPetsFW");

        var reader = new Reader
        {
            VendorID = 1,
            LogFile = @"C:\WEB460\DataImport\Output\Import09.log",
            DebugLevel = 3
        };

        const string fileName = @"C:\WEB460\DataImport\20090310-Products.txt";

        //string output = !reader.DoImport(fileName, connection) ?
        //            "There was an problem with the import." :
        //            "Import Successful.";
        //Console.WriteLine(output);

        lblError.Text = !reader.DoImport(fileName, connection) ? "There was an problem with the import" : "Import Successful";
    }
开发者ID:jasonhuber,项目名称:devryweb460store,代码行数:27,代码来源:Import.aspx.cs

示例2: btnFileUpload_Click

    protected void btnFileUpload_Click(object sender, EventArgs e)
    {
        //this does not work yet, meant to browse for the file to be Imported.
        var connection = new SQLServerConnect();
        connection.SetupConnectionString("TestUser", "testuser", @"Jon\SQLEXPRESS", "MyPetsFW");

        var reader = new Reader
        {
            VendorID = 1,
            LogFile = @"C:\WEB460\DataImport\Output\Import01.log",
            DebugLevel = 3
        };

        if (myFileUpload.HasFile)
        {
            myFileUpload.SaveAs(Server.MapPath("uploads/" + myFileUpload.FileName));
        }

        lblError.Text = !reader.DoImport(myFileUpload.ToString(), connection) ? "There was an problem with the import" : "Import Successful";
    }
开发者ID:jasonhuber,项目名称:devryweb460store,代码行数:20,代码来源:Browse.aspx.cs


注:本文中的Reader.DoImport方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。