G'Day everybody,
Quick question. I am using MySQL for a database. I have textfiles that have to be converted and then loaded into MySQL. I have written a program to do the conversion. I am having a problem with getting the program to load the result textfile into MySQL. I have been trying to use mysqlimport, but I cannot get it to work. It works on a direct command line, but not in the program. Here is a bit of code:
Code:
using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
namespace CSCommandLine
{
class Command
{
[STAThread]
static void Main(string[] args)
{
Process myProcess = new Process();
try
{
string filename = "F:\\Test Folder\\MYSQL Update\\patientfile.txt";
//myProcess.StartInfo.FileName = "mysqlimport.exe";
//myProcess.StartInfo.Arguments = "jmapatients" + filename;
//myProcess.StartInfo.CreateNoWindow = true;
//myProcess.Start();
//myProcess.WaitForExit();
Process.Start("mysqlimport.exe", "jmapatients " + filename);
Console.ReadLine();
}
catch(Exception ex)
{
Console.WriteLine("" + ex);
Console.ReadLine();
}
}
}
}
I have tried a bunch of different approaches and nothing works. With this code, it runs, but does not update the database. A window with some text in it pops up for a split second and closes, but nothing happens to the database. Are there any suggestions?????????
Thanks,
Kendal