Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update sql table from dataset/data adaptor

Status
Not open for further replies.

richey1

Technical User
Oct 5, 2004
184
GB
Hi

I'm starting looking at vb.net.
I've created a SQL Data Adaptor - generated a dataset from t that - generated the sql stored procedures for insert etc - created some fields on my form - data-bound them to the field in the database - if i create a commit button how do i, on the click of that, insert that into the sql database ?
and also what is the best method for validation ?

regards
kim
 
Start your vb net project. Do a Search in help for commandtype. You SHOULD find an entry titled "Running Stored Procedures From Code" or something very close. It gives you a good starting point.

As far as the best way to validate? There are probably a number of ways.

You would want to trap each field for the appropriate types of data (i.e. Are you entering numbers when you expect text), Do the fields have values entered if the field is required? Does your data fall within expected ranges? You can do these checks either whn a field losses focus, or on your commit button before the actual insert takes place. IF there is a mistake, take your user back to the field that needs correcting, and pop up a message box stating what the mistake or error is.

You might also think about using a try ..catch..finally construct to trap for various errors including database availability, etc.

Also think about buying a good VB .Net intro book. Wrox press has one I use. It also includes a chapter on database programming and web programming.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top