INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Datatable info

Datatable info

(OP)
I am updating a program I wrote in VB5 to VB2008 express. I am trying to determine if when I update a dataset or a datatable do I have to write a update query or can I somehow link the textboxes/checkboxes/comboboxes to the fields in the table similarly to what was done in vb5. I have update already 1 database front end, but this database table only had about 30 fields. The other program is going to have I think over 100. The one with 30 fields seems to take about 2 - 3 seconds to update over the intranet and I am looking for a faster way. Also, wanted to avoid all the typing setting the textboxes value and then writing the query if there is a faster more efficient way.

Thanks is advance for your help.

Chris

RE: Datatable info

Here's a quick rundown on how you can do this:

1) On the right of the Visual Studio IDE, at the bottom of Soultion Explorer pane, there is a tab named "Data Sources". Select that tab.

2) In Data Sources, right-click and select "Add New Data Source", then follow the Data Source Configuration wizard.

3) Once the data source is set up, expand it and select the table you want. When you select the table in the list, you should see a drop down arrow appear at the right of the table's name. Select the drop down and then select "Details" in the drop down list.

4) After selecting Details, left-click the table and drag it to a form. After this finishes, you should see controls for all the table's fields, and at the bottom of the Form pane, you should see a <table_name>DataSet, <table_name>BindingSource, <table_name>TableAdapter, <table_name>TableAdapterManager, and <table_name>BindingNavigator. At the top of the form, you should see navigation controls, as well as controls to add, delete and save.


Of course it can get a bit more involved, but this should get you started.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!

RE: Datatable info

(OP)
Thanks for the reply. I will give it a try. However, it will be next week. I will post back with more questions I am sure.

Chris

RE: Datatable info

(OP)
I have it where it display all the information. I have not changed or modified anything (code or design layout) but get this error when modify a field and try to save

"Update requires a valid updatecommand when passed datarow collection with modified rows"


CODE

Private Sub TblMSDSBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TblMSDSBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.TblMSDSBindingSource.EndEdit()
  ERRORS HERE -->        Me.TableAdapterManager.UpdateAll(Me.Wizdata2014DataSet) 

RE: Datatable info


The Table Adapter needs 4 command objects to fully function: SelectCommand, InsertCommand, UpdateCommand and DeleteCommand. The SelectCommand is created automatically when you generate the TableAdapter with the Data Source Configuration wizard. You have to set up the InsertCommand, UpdateCommand and DeleteCommand.

Check out this link and see if it helps: http://www.asp.net/web-forms/overview/data-access/...

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!

RE: Datatable info

(OP)
I went to the updatecommand. Added new.

command text

UPDATE tblMSDS
SET MasterMSDSID =, MSDSNo =, ProductNumber =, ProductName =

Commandtype: text



Now I am getting "sytax error in update statement"

the error code line is
Me.TableAdapterManager.UpdateAll(Me.Wizdata2014DataSet)



This is a single table and not a joined table. There is a primary Key "MasterMSDSID"

The table has about 100 fields. Do I have to change the update command to point to each individual text box.

Thanks for the help.

Chris

RE: Datatable info

Did you try having the TableAdapter automatically generate the commands?

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!

RE: Datatable info

(OP)
Yes but it did not generate anything.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close