Stringdbnamethis. context. parameters [& quot; dbname & quot;]; database name stringserverthis. context. parameters [& quot; server & quot;]; server name stringuidthis. context. parameters [& quot; user & quot;]; SQlServer username stringpwdthis. context. parameters [& quot; mysql project release package c # Project development code error correction
String dbname = this. context. parameters ["dbname"]; // database name string server = this. context. parameters ["server"]; // server name string uid = this. context. parameters ["user"]; // SQlServer username string pwd = this. context. parameters ["pwd"]; // password string path = this. context. parameters ["targetdir"]; // installation directory String appDirecroty = "C :\\ Program Files \ MySQL Server 5.6 \ bin \\"; stringBuilder sbcommand = new StringBuilder (); string directory = path + "database" + "\" + "121www. SQL "; sbcommand. appendFormat ("mysql-uroot-p123456 121www <{0}", directory); String command = sbcommand. toString (); // MessageBox. show (command); Cmd. startCmd (appDirecroty, command );
It is written in Cmd in this way.
Public class Cmd
{
///
/// Execute the Cmd command
///
/// Directory of the process to be started
/// Command to be executed
Public static void StartCmd (String workingDirectory, String command)
{
Process p = new Process ();
P. StartInfo. FileName = "cmd.exe ";
// MessageBox. Show (p. StartInfo. WorkingDirectory );
P. StartInfo. WorkingDirectory = workingDirectory;
// MessageBox. Show (p. StartInfo. WorkingDirectory );
P. StartInfo. UseShellExecute = false;
P. StartInfo. RedirectStandardInput = true;
P. StartInfo. RedirectStandardOutput = true;
P. StartInfo. RedirectStandardError = true;
P. StartInfo. CreateNoWindow = true;
P. Start ();
P. StandardInput. WriteLine (command );
// MessageBox. Show (command );
P. StandardInput. WriteLine ("exit ");
}