예제 #1
0
파일: ASQL-A3.cs 프로젝트: WilliamPring/SET
 /// <summary>
 /// Submit to execute program
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void submit_Click(object sender, EventArgs e)
 {
     string tableSrc = "";
     string tableReading = "";
     string errorMessageTotal = "Error List:\n\n";
     //check parmeter to see if its empty
     if (sourceTable.TextLength ==0)
     {
         errorMessageTotal += "Error Missing Parameter For Source Table\n";
     }
     //check parmeter to see if its empty
     if (destinationTable.TextLength == 0)
     {
         errorMessageTotal += "Error Missing Parameter For Destination Table\n";
     }
     if ((sourceConnectionString == null) || (destinationConnectionString == null))
     {
          errorMessageTotal += "Connection String Error\n";
     }
     if (errorMessageTotal != "Error List:\n\n")
     {
         System.Windows.Forms.MessageBox.Show(errorMessageTotal);
     }
     else
     {
         //get the text for the table name
         tableReading = sourceTable.Text;
         //get the text for the table name
         tableSrc = destinationTable.Text;
         //create the ConnectionClass
         ConnectionClass connection = new ConnectionClass(sourceConnectionString, destinationConnectionString, tableReading, tableSrc);
         //Connect for the sorce and dest
         bool status = connection.Connect();
         if(status == false)
         {
             //getting infromation about the table
             status = connection.GetInformation();
             if (status == false)
             {
                 //inserting it to the new table
                 connection.SetInformation();
             }
             else
             {
                 //error message
                 errorMessageTotal += "Writing Table Error\n";
                 System.Windows.Forms.MessageBox.Show(errorMessageTotal);
             }
         }
         else
         {
             errorMessageTotal += "Copying Table Error\n";
             System.Windows.Forms.MessageBox.Show(errorMessageTotal);
         }
     }
 }