I am trying to create a form to manage customer info.
The database I am using is a SQL Express database I created in Visual Studio. "localDB.sdf"
On the left is a list box which I want to set the Display Member to a concatination of the customer's first name and last name, pulled from the "FirstName" column and "LastName" column in the database. The Key ID, "ID" column, should be
assigned to the listbox's Value Member.
When a name is selected in the listbox, it should populate all of the customer's info in textboxes to the right.
I have three buttons: New, Update, and Cancel.
The New button should insert a new row into the database with all blank fields, except the Key ID which auto-increments. It should then reload the listbox to show the blank field and obviously all the textbox will load blank too.
The Update button should obviously update the database according to Key ID from the Value Member of the listbox based on the selected index. The list box should the be reloaded to show the new first and last name concatinated together.
I have tried using the objects Visual Studio auto generates. The objects work great in doing everything I want, except the tableAdapter does not update back to the database when using the tableAdapter.Update(dataset.tableName) method.
So I tried using SqlCe command. I can update the database this way, but I cannot load queried info into the listbox, nor have the IndexSelectedChanged to load the info into all the textboxes based on the selected option in the listbox.
I have also tried Linq but can not get that to work at all.