Question: I have a `List<string>` where are stored database table column name. 

I need to select only this column (where name is stored into list) from a c# linq query. 

Is possible? 

I Try this code but I don't know how I can place in select: 

I try this code

```
items = items.ToList();
            _items.Add(new FieldItem() { FieldName = "field1" });
            _items.Add(new FieldItem() { FieldName = "field2" });
            _items.Add(new FieldItem() { FieldName = "field3" });
            _items.Add(new FieldItem() { FieldName = "field4" });

            _db.Table.Where(a => a.TimeStamp > DateTime.Now.AddHours(-1)).Select(....);

```

Thanks

Answer: 
The reason why it always returns true is because you have declared `name` and `password` in two local namespaces. One in the main body of your code and one within the function `login()`. `name` and `password` within the `login()` function both equal `None` because they never have an assigned value. Meaning that they are always equal and will always return `True`.

Change the function to the below:

```
def login():
    if input_name.get() == input_password.get():
        for widget in root.winfo_children():
            widget.grid_forget()
        login_true = Label(root, text="Welcome", fg="black")
        login_true.grid()
    elif input_name.get() != input_password.get():
        for widget in root.winfo_children():
            widget.grid_forget()
        login_false = Label(root, text="login fail", fg="black")
        login_false.grid()

```

---

Using `.bind()` on a `Button` widget for `<Button-1>` tends to be a terrible idea. `Button` widgets have a built in attribute called `command` which can be used to called get a callback when clicked:

```
from tkinter import *

root = Tk()

def login():
    print("Login triggered")

login_button = Button(root, text="Login", command=login)
login_button.pack()

root.mainloop()

```

---

On a side note, if you need to pass any parameters at the same time, then the simplest way to do this is with Python's anonymous function `lambda`. This can be accomplished like the below:

```
from tkinter import *

root = Tk()

def login(variable):
    print("Login triggered")

login_button = Button(root, text="Login", command=lambda: login("variable"))
login_button.pack()

root.mainloop()

```
I never used tkinter but I guess it's because you're calling the `get` method while your initialising the gui. (`name = input_name.get()`)
Instead you should only call this when the user clicks the button, which is inside the `login` method.

```
from tkinter import *

root = Tk()

label_name = Label(root, text="Username", fg="black")
label_password = Label(root, text="Password", fg="black")
input_name = Entry(root)
input_password = Entry(root, show="*")

label_name.grid(row=0, column=0, sticky=E)
label_password.grid(row=1, column=0, sticky=E)

input_name.grid(row=0, column=1)
input_password.grid(row=1, column=1)

checkbox = Checkbutton(root, text="Remember me")
checkbox.grid(columnspan=2, sticky=W)

login_button = Button(root, text="Login")
login_button.grid(row=1, column=2)

login_success = Label(root, text="Welcome", fg="black")
login_fail = Label(root, text="login fail", fg="black")

def login(event):
    name = input_name.get()
    password = input_password.get()
    if name == password:
        for widget in root.winfo_children():
            widget.grid_forget()
        login_true = Label(root, text="Welcome", fg="black")
        login_true.grid()
    elif name != password:
        for widget in root.winfo_children():
            widget.grid_forget()
        login_false = Label(root, text="login fail", fg="black")
        login_false.grid()

login_button.bind("<Button-1>", login)

root.mainloop()

```