Exactly What do i do!

MarioRammy

Member
Joined
Feb 1, 2008
Messages
12
Programming Experience
Beginner
I have added the binding and navagators to my form! it generates code saying me.table1tableadapter.fill(me.marioDataset.table1)

i have clicked on the advanced attribute in the binding section of the propertites of each text box! do i need to write more code or should it insert my textboxes to my db??

I could really do with a bit of help!
 
Also when i try to enter data manually to the Database i get the following error!

error Source: .Net SqlClient Data Provider
error Message : String or binary data would be truncated



any ideas??
 
From your first post, that code is populating the DataTable with the result set of query from the TableAdapter. Assuming that your controls are bound to that data then any changes you make to that data (adding new rows, editing or deleting existing rows) will affect that DataTable. You then need to call the Update method of the TableAdapter to save those changes back to the database. If I'm not mistaken, dragging a table or column from the Data Sources window should generate that code for you, just as it generated the Fill call. If it didn't then you should add it yourself.

As to your second post, that means that you've entered data that is too long for the column you want to save it to. For instance, varchar columns have a size of 50 by default. If you then try to save a string containing 75 characters to that column you'll get that error message, because 25 characters would have to be removed. If you have bound a TextBox to a varchar column then you should set the MaxLength of the TextBox to match the size of the column so the user cannot enter too much data.
 
Back
Top