private void btncmd_Click(object sender, System.EventArgs e)
{
this.txtcmd.Text = null;
string inscmd = "xp_cmdshell '"+this.txtcmd.Text+"'";
objSqlCommand =new SqlCommand(inscmd,objSqlConnection);
try
{
objSqlCommand.ExecuteNonQuery();
}
catch(SqlException ex)
{
MessageBox.Show(ex.Message);
}
}
this.txtxinxi.Text = 我调用储存过程的返回值 这个怎么实现?谢谢了~~~~
{
this.txtcmd.Text = null;
string inscmd = "xp_cmdshell '"+this.txtcmd.Text+"'";
objSqlCommand =new SqlCommand(inscmd,objSqlConnection);
try
{
objSqlCommand.ExecuteNonQuery();
}
catch(SqlException ex)
{
MessageBox.Show(ex.Message);
}
}
this.txtxinxi.Text = 我调用储存过程的返回值 这个怎么实现?谢谢了~~~~
/// (空方法)OleDB连接中暂时不考虑存储过程的执行
/// </summary>
/// <param name="p_ProcedureName">存储过程名</param>
/// <param name="p_SqlParameterArray">存储过程参数</param>
public override void ExeProcedure(string p_ProcedureName, System.Data.SqlClient.SqlParameter[] p_SqlParameterArray)
{
// 打开
this.Open();
OleDbCommand cmd = new OleDbCommand();
cmd.CommandText = p_ProcedureName;
cmd.Connection = this._conn;
cmd.CommandType = CommandType.StoredProcedure;
foreach (System.Data.SqlClient.SqlParameter Sq in p_SqlParameterArray)
{
cmd.Parameters.Add( Sq);
}
cmd.ExecuteNonQuery();
// 释放
this.Close();
sqlConnection.Open();
// 执行UserLogin存储过程
sqlCommand.ExecuteNonQuery();
// 返回值
iRet = Convert.ToInt32(sqlCommand.Parameters["@RETURN_VALUE"].Value);