Use variable in Parameters

1

I'm trying to run the line below, but I need to use variables. The line is as follows:

CM.Parameters.Add("desnome", System.Data.SqlDbType.VarChar).Value = USU.xdes_nome;

I need the following: desnome by variable Varchar by variable USU.xdes_nome per variable

Does anyone have a clue how I can do it?

    
asked by anonymous 25.10.2017 / 14:45

1 answer

0

Your question is totally vague, but try the following:

    CM.Parameters.Add("@desnome", SqlDbType.Int);
    CM.Parameters["@desnome"].Value = USU.xdes_nome;

For the above example to work, you need to check the "user.xdes_name", if you are referring to a variable being called from some class, it is correct, otherwise modify the name.     

26.10.2017 / 21:57