Click here to Skip to main content
15,894,106 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi,

I am using vb.net 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,

Peter.
Posted
Updated 2-Oct-12 13:50pm
v13
Comments
Sergey Alexandrovich Kryukov 1-Oct-12 20:06pm    
This is called "schema evolution", the whole issue. What did you find exactly, and what "cannot work"?
--SA
PeterScaletti 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 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.
--SA
PeterScaletti 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900