I am new to programming. I was hoping for some help to correct the below code.
I have a WinForms application using an Azure SQL database. overall I am trying to automatically import a CSV file as it arrives in a cdrive location.
I have researched and tried BCP but failed to get passed Azure's security on my own account...., I don’t think my syntax is correctly built. I have also looked into Blob storage option again without much luck. I need to do more research on these options.
if I apply the following directly to the command line
dtexec/f “C:\InboundWindow\ImportScript.dtsx
I get a successful result outputted. With this, in mind, I have then dragged a fileSystemWatcher to my WinForms and then applied the following code.
private void fileSystemWatcher1_Created(object sender, FileSystemEventArgs e) {
// Process.Start("cmd", @"/C dtexec/f “C:\InboundWindow\ImportScript.dtsx");
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.Arguments = @ "/C dtexec/f “C:\InboundWindow\ImportScript.dtsx";
p.StartInfo.RedirectStandardOutput = false;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = false; //don't show the console at all
p.Start();
// FullPath is the new file's path.
MessageBox.Show(string.Format("Created: {0} {1}", e.FullPath, e.ChangeType));
}
this is where it now fails I have tried many variations found on various forums however the .dtsx file is never imported to Azure SQL database. however, I get a return message stating a change in the folder.
Any help in highlighting where I am going wrong and correcting the above would be great. please bear with me as I am new to c# and programming in general. thanks