Victor BA

I added a data source in my C# project, but know i don't need it, how can i remove it i don't see any "delete" option in the data sources window

Re: Visual C# IDE Delete a datasource

mwalts

Hmm, I'll admit, I don't do much of my data bindings through the wizards (well... none), but I'm guessing you mean that little window that shows up when you click on the "Choose Data Source" or DataSource in the properties combo box

First, make sure you don't still have anything pointing to it, if something is, point it to what it belongs to or select none

Next, look under the form in your form designer and find the object with the same name (something like tableNameBindingSource for example) click on it, and check on it's datasource. Record it's name (i.e. databaseNameDataSet) now you can delete those two things (just click on them and hit delete). Finally find the the item called something like TableNameTableAdapter (it should have a similar name to the BindingSource anyway, and it will be of type visualQue.DatabaseNameDataSetTableAdapters.TableNameTableAdapter)

And delete that. And now you've undone the huge amount of code the designer created for you automatically.


-mwalts




Re: Visual C# IDE Delete a datasource

SteveS_MS

Hello,

This is from the How to: Remove Data Sources from the Data Sources Window help topic:

http://msdn2.microsoft.com/en-us/library/ms233820(VS.80).aspx

To remove a database data source from the Data Sources window

  • Select the dataset in Solution Explorer and remove it from the project.

    The corresponding data source disappears from the Data Sources window.

    Note

    If the data source is still visible in the Data Sources window, then click the Refresh button in the window.

To remove a Web service data source from the Data Sources window

  • Right-click the Web service data source in the Data Sources window and choose Remove Web Reference.

    ¨Cor-

  • Right-click the Web reference in Solution Explorer, and choose Delete.

To remove an object data source from the Data Sources window

  • Right-click the object data source in the Data Sources window and select Remove Object.






Re: Visual C# IDE Delete a datasource

mwalts

Heh, I tried that now cause it seemed much easier... and it broke form designer!
"The variable 'lastDiskWarningDateDataGridViewTextBoxColumn' is either undeclared or was never assigned. "
can't recompile either... it was a silly sample project so it doesn't matter, plus I know how to fix it easily enough, but not the best for an excepted help method. That is one thing I left out of my method though, once you have removed the other objects, you can delete the DataSet from the solution explorer.

I also assumed that the DataSource was a Database which it might well not be.

-mwalts




Re: Visual C# IDE Delete a datasource

SteveS_MS

Hello,

Yes, like other references, components, etc... - any references to the deleted data source will cause compiler issues if you do not remove them from the form prior to deleting from the project. For example, the Datasets, BindingSources, BindingNavigators, TableAdapters, etc... all need to be removed from the form.

hope that helps....