本文整理汇总了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";
}
示例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";
}