Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Add/Change Column names

Posted on 2006-04-02
Medium Priority
Last Modified: 2010-05-18
I started using a typed datatable.   Now, of course, I want to change a column name, and will want to add/delete columns going forward.   I see three steps:

A)  make the changes in the DB
B)  make the changes in the XML Schema for the typed data set
C)  make the changes in the code

What's the best approach for making the changes in the XML Schema?  Edit the schema directly?  Regenerate the table adapter?  Other?   Did I leave out something else important?

Question by:codequest
  • 3
  • 2

Accepted Solution

pbocanegra earned 2000 total points
ID: 16355865
IN the .vb page change the dataadapter in the property "SelectCommand" with the new columns, and then press in the bottom "Generate Dataset". VB.Net automatically generate the new xml schema.

LVL 14

Expert Comment

ID: 16356044
The table adapter will change the XML schema for you. Regenerating the table adapter should work, but you don't have to. You can go to the dataset designer (go to the DataSources tab and right click on the dataset you want to modify, choose "Edit DataSet with Designer"), then go to the tableadapter's property page where you can modify the SelectCommand's CommandText. Click on "..." and a Query Builder is opened where you can modify the columns. After you click OK on the Query Builder, it will prompt you whether you want to regenerate the UpdateCommand, click Yes and it's done automatically for you.

Author Comment

ID: 16356066
Thanks for the input.   In this case I'm not defining the dataadapter on a page...I'm using a dataset item in App_Code.  However, because of your message, I guessed that it wasn't that tricky, so I:

> deleted the table in the dataset designer,
>  changed the DB definition (SQL Server Express)
> dragged the table from the DB back into the designer
> selected configure on the table in the designer (right click) and made some adjustments
> completed configuration
> updated the vb field calls

and it worked on the first try.

Next time maybe I'll look for a way to update it without the delete and re-add.

Thanks for the prompt...that's what did it.

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 14

Expert Comment

ID: 16356070
While you are on the dataset designer, you could also right click on the datatable name and choose "Configure...". This will open the TableAdapter Configuration Wizard where you can edit the query.
LVL 14

Expert Comment

ID: 16356078
You mentioned table adapter in your question, which made me think that you are using VB2005, LOL. Anyway, when you upgrade to 2005, that's the step you can use.

Author Comment

ID: 16356083
amyhxu:  thanks for the response...I saw it too late.  Please look for question "amyhxu  Q_21798590 additional points" for additional points...I'll accept a response from you there.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question