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