As follows: Code :
Called method:
Copy code The Code is as follows: public static string execommand (string commandtext)
{
PROCESS p = new process ();
P. startinfo. filename = "cmd.exe ";
P. startinfo. useshellexecute = false;
P. startinfo. redirectstandardinput = true;
P. startinfo. redirectstandardoutput = true;
P. startinfo. redirectstandarderror = true;
P. startinfo. createnowindow = true;
String stroutput = NULL;
Try
{
P. Start ();
P. standardinput. writeline (commandtext );
P. standardinput. writeline ("exit ");
Stroutput = P. standardoutput. readtoend ();
P. waitforexit ();
P. Close ();
}
Catch (exception E)
{
Stroutput = E. message;
}
Return stroutput;
}
Call method:Copy codeThe Code is as follows: protected void button#click (Object sender, eventargs E)
{
String sqlquery = "sql0000.exe-U sa-P 123-s 20100330-0922-d test-I c: \ 1. SQL ";
String strrst = execommand (sqlquery );
}
1. SQL FileCopy codeThe Code is as follows: use master
Go
Create endpoint orders_endpoint6
State = started
As HTTP (
Path = '/SQL/orders6 ',
Authentication = (integrated ),
Ports = (clear)
)
For soap (
Webmethod 'stordersorders '(
Name = 'test. DBO. getalltb12'
),
WSDL = default,
Database = 'test ',
Namespace = 'HTTP: // mysite.org /'
)
BSProgramIf it is executed, I wonder if sqlcmd is not installed on the client. Can it be run?