Beispiel #1
0
        public bool insertUser(string Username, string Password)
        {
            My_DB      mydb = new My_DB();
            SqlCommand cmd  = new SqlCommand("INSERT INTO log (Username, Password)" +
                                             "VALUES (@username, @pass)", mydb.GetConnection);

            cmd.Parameters.Add("@username", SqlDbType.NVarChar).Value = Username;
            cmd.Parameters.Add("@pass", SqlDbType.NVarChar).Value     = Password;

            mydb.openConnection();
            if (cmd.ExecuteNonQuery() == 1)
            {
                mydb.closeConnection();
                return(true);
            }
            else
            {
                mydb.closeConnection();
                return(false);
            }
        }
Beispiel #2
0
        public bool verifyAccountUser(string username)
        {
            My_DB db = new My_DB();

            SqlDataAdapter adapter = new SqlDataAdapter();

            DataTable  table   = new DataTable();
            SqlCommand command = new SqlCommand("SELECT * FROM log WHERE Username = @username", db.GetConnection);

            command.Parameters.Add("@username", SqlDbType.NVarChar).Value = username;

            adapter.SelectCommand = command;

            adapter.Fill(table);

            if (table.Rows.Count > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }