David Smith

David Smith

  • NA
  • 2k
  • 0

BCP Error

Mar 27 2012 10:44 PM
Can someone tell me what i am doing wrong, I am getting error saying cannot use the output option when passing a constant to a stored procedure
 
// open source connection
  using (SqlConnection c = new SqlConnection(conn))
  {
  c.Open();

  using (SqlCommand cmd = c.CreateCommand())
  {
  //cmd.CommandType = CommandType.StoredProcedure;
  cmd.CommandText = "exec master..xp_cmdshell bcp 'Select * FROM TOW_ESS_SQL.dbo.PDEL' queryout 'C:\\Test' -c -t; -T -SZTURA054052 ";

  cmd.ExecuteNonQuery();

  return true;
  }
  }

----------------------------------------------------------

below this work on my computer if I run the batch file but on other computers, it does not run for some reason, the command window pops up and then leaves. I am not for sure why.