Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: SQL VB.NET
I am using 2005 and I have a sql express database table I have named "Clients". Every so often I need to add a new column to the Clients database table programatically, which I can do ok.
The problem is getting the existing ClientsDataSet on the VB Form [Design] Screen to update programatically to include the new column in the Clients Table in the Dataset Designer, and to include the new column in the ClientsTableAdapter query.
I have searched the web and have worked out how to update the schema with Fillschema, but this is for newly created datasets and datatables, not existing.
Can someone please explain how to programatically update an existing dataset table and tableadapter attached to a VB Form, to include a new column added into a sql database table?
Thank you,
Posted 1-Oct-12 13:53pm
Edited 2-Oct-12 14:50pm
Sergey Alexandrovich Kryukov at 1-Oct-12 20:06pm
This is called "schema evolution", the whole issue. What did you find exactly, and what "cannot work"?
PeterScaletti at 1-Oct-12 20:33pm
Hi Sergey, thank you for your comment. I am unable to get a table within an existing dataset and an existing tableadapter query, to update, to include a new column that has been added into a sql database.
Sergey Alexandrovich Kryukov at 2-Oct-12 10:40am
Maybe, if you can produce a relevant short code sample, somebody or myself would be able to see what's wrong. You also need to describe what you expected to get and what exactly happened instead.
PeterScaletti at 2-Oct-12 19:46pm
Hi Sergey, thank you for your reply.
This is what I have found,(where objConn is the sql connection string):
Dim daCients As New SqlDataAdapter("Select * From Clients", objConn)
Dim dsClients As New DataSet("Clients")
daClients.FillSchema(dsClients, SchemaType.Source, "Clients")
From this I have been able to create a new dataset and new tableadapter with the updated sql database schematics. What I require, and I am unable to do, is to update an existing dataset and tableadapter.
Thank you, Peter Scaletti

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 245
1 Kamal Rocks 184
2 Sergey Alexandrovich Kryukov 175
3 BillWoodruff 173
4 PIEBALDconsult 160
0 OriginalGriff 5,655
1 DamithSL 4,506
2 Maciej Los 3,997
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180

Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 2 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100