locked
why the result its always "dbo" ? RRS feed

  • Question

  • User-1721146871 posted
    i have this code:
            public static String VN(string user)
            {
                ArrayList sqlparams = new ArrayList();
                sqlparams.Add(new SqlParameter("User1", user));
                return (Convert.ToString(OleDbHelper.executeScalar("SELECT User FROM Utilizador WHERE [User]=@User1", (SqlParameter[])sqlparams.ToArray(typeof(SqlParameter)))));
            }
    
    and the user result is always "dbo"
    
    can some one tall me why ? help plzz
    

    Tuesday, June 21, 2011 9:26 AM

Answers

  • User-1952482173 posted

    User is a reservered word. You have to use [User] in your query.

    SELECT [User] FROM Utilizador WHERE ...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 21, 2011 9:46 AM

All replies

  • User-693248168 posted

    Hi,

    Try changing your line

      sqlparams.Add(new SqlParameter("User1", user));

    to

      sqlparams.Add(new SqlParameter("@User1", user));
    Tuesday, June 21, 2011 9:39 AM
  • User-1952482173 posted

    User is a reservered word. You have to use [User] in your query.

    SELECT [User] FROM Utilizador WHERE ...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 21, 2011 9:46 AM