I have two major problems about running OSQL from my c# code, first is running .sql commands using -i parameter with long and blank containing file locations and the second is passing the right command format to command prompt.
1- When I type a command like
osql works fine.
osql -U test -P testpass -S PROJETEST -i C:\testsql.sql
But when I change it to sth like
I get an error like "osql does not support all features of SQL Server 2008 R2." Adding the " at the beginning and end of the file location did not work.
osql -U test -P testpass -S PROJETEST -i C:\Users\ceyhun.ganioglu\Documents\Visual Studio 2008\Projects\TestProjectLoader\TestProjectLoader\bin\Debug\sqlscripts\2008_r2\testsql.sql
2- I have the following code in my C# code. Does not matter if I get the directory dynamically or just type C:\\testsql.sql after -i parameter, I get the same error.
I could not make it work at all. Can anybody help?
string mevcut_adres = Directory.GetCurrentDirectory();
Process.Start("cmd.exe", "/K osql -U " + kullanici_adi.Text + " -P " + kullanici_sifre.Text + " -S " + sql_server_list.Text + "-i " + mevcut_adres + "\\sqlscripts\\2008_r2\\test.sql");