System.ComponentModel.Component in Visual Studio 2008
I maintain a .NET application using Visual Studio 2008. When the application was created it was originally in Visual Studio 2003 and used the System.ComponentModel.Component class to access the data. You can drag and drop commands, connections, etc. The component's design surface.
In 2008, data access classes are not bound to a component. Ie, the code for the command is not generated in the class.
- When did this change? 2005?
- Is there a replacement for this behavior, perhaps using the db pro edition?
Thanks.
0
a source to share
1 answer
Replace is either used with typed datasets (use Add-> New Item and select DataSet, then drag tables, views, or stored procedures onto the design surface). Or Entity Framework / LINQ for objects.
And yes, that changed in VS2005.
A little research got me thinking because "it works for me".
- Open a simple class library project
- Right click and choose Add β Component. The component is created and the familiar design surface of the component is displayed.
- View the toolbar. Please note that SqlCommand etc. It doesn't. Right-click on the toolbar and choose Select Items.
- Enter "System.Data" in the filter field. This will help you find all your old friends "SqlConnection", "SqlCommand", "SqlDataAdapter" and even "DataSet" and "DataView". Select them all and click "Ok".
- Drag the SqlConnection onto the design surface. Set it up as usual.
- Drag the SqlCommand onto the design surface, set up as usual. I even set the Connection property to point to my first SqlConnection.
- Drag the "SqlDataAdapter" onto the design surface. The normal Configure Data dialog box appears. Configure the adapter, select Create DataSet, and so on.
- Save the component and close it.
- Open the component again. All of these things are still there.
What have you tried that didn't work?
0
a source to share