vb.net Query error binding dataset to combobox with autonumber primary key
Posted on 2006-03-30
I am trying to setup a valuemeber for a combobox so I can use it for other queries.
My table (simplified) is Account
IDAccount = (PK) Autonumber Long Integer
bName = text 50
it is an Access database.
I have the following code
dim sql as string = "SELECT bName, IDAccount " _
& "From Account " _
& "ORDER BY bName"
dim ds as New dataset
cmboAccounts.DisplayMember = "bName"
cmboAccounts.valueMember = "IDAccount"
cmboAccounts.DataSource = ds.Tables("Account")
On cmboAccounts.DataSource = ds.Tables("Account") I get the following error "Syntax error (missing operator) in query expression 'Account.IDAccount ='."
Please help. I'd really like an answer today so i'm making it high points.