Click here to Skip to main content
12,454,164 members (58,471 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB SQL VB.NET
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 1-Oct-12 12:53pm
Updated 2-Oct-12 13:50pm
v13
Comments
   
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.
   
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 2 Oct 2012
Copyright © CodeProject, 1999-2016
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