'SQL Server could not run the procedure separately

I'm working on a Winforms application in C# that was written by someone else.

I have access to the app source code and SQL Server database.

When I exec a stored procedure in SQL Server Management Studio, that is used in App source like

Prc_Qry_Task_List_Unit @Month_Period =  Month_Period_cmbx.Text 

it can not find the stored procedure to exec and returns nothing (I tried all the ways and search to execute it even search for its file one by one to find it but nothing)

But when compiling and running the main app in Visual Studio, it works fine (it can execute the stored procedure).

Application source code :

public static bool ExecQuery(string Query, ref DataSet ds)
{
    dataAdapter.SelectCommand.CommandType = CommandType.Text;
    dataAdapter.SelectCommand.CommandText = Query;
    dataAdapter.Fill(ds);
    return true;
}

// "Month_Period_cmbx.Text" And "Unit" Are user inputs
DataSet ds = new DataSet();

if (ConnMan.ExecQuery("Prc_Qry_Task_List_Unit @Month_Period = '" + Month_Period_cmbx.Text + "', @Unit = " + Unit, ref ds))
{
    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    {
        string ID = ds.Tables[0].Rows[i][0].ToString();
    }
}       
 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source