C# Prepared Statements - @ sign (at / strudel sign) queries

前端 未结 3 1594
滥情空心
滥情空心 2021-01-11 22:35

I Have a problem with a prepared statement in C#:

OdbcCommand cmd = sql.CreateCommand();
cmd.CommandText = \"SELECT UNIQUE_ID FROM userdetails WHERE USER_ID          


        
3条回答
  •  北海茫月
    2021-01-11 22:57

    Use '@USER_ID' instead of '?' and all should work:

    OdbcCommand cmd = sql.CreateCommand();
    cmd.CommandText = "SELECT UNIQUE_ID FROM userdetails WHERE USER_ID = @USER_ID";
    cmd.Parameters.Add("@USER_ID", OdbcType.VarChar, 250).Value = email;
    

提交回复
热议问题