tags:

views:

40

answers:

2
SqlCommand cmd = new SqlCommand("FlowClientHardQ 0, 10, 1, 1, 364, Null", conn);

works with no error

SqlCommand cmd = new SqlCommand("FlowClientHardQ @ID_User, @ID_ListGroupParIzm, 1, 1, @CIzmer, Null", conn);
            cmd.Parameters.AddWithValue("@ID_User", user);
            cmd.Parameters.AddWithValue("@ID_ListGroupParIzm", ID_ListGroupParIzm);
            cmd.Parameters.AddWithValue("@CIzmer", izmer);

Incorrect syntax near the construction "FlowClientHardQ"

+1  A: 

Need to set CommandType to be StoredProcedure?

gbn
StoredProcedure, you helped me to wrote it ^_^
nCdy
+5  A: 

Just do this:

    SqlCommand cmd = new SqlCommand("FlowClientHardQ", conn);
    cmd.Parameters.AddWithValue("@ID_User", user);
    cmd.Parameters.AddWithValue("@ID_ListGroupParIzm", ID_ListGroupParIzm);
    cmd.Parameters.AddWithValue("@CIzmer", izmer);

If you're calling a stored procedure, just set the command text to be the stored procedure name, and add the parameters like you're doing. Set the command type to StoredProcedure before you execute it.

womp