Saturday, February 25, 2012

Can someone please tell me how to go about changiing a datasource/dataset schema?

I have managed to cobble up a VS2005 PPC app that has 10 or so tables in it. Of course when I started binding to the tables in my app, pretty soon I ran into an error I had made defining a datatype for a column in one table. Single instead of string. I have spent most of the day trying to modify something to change this column datatype. No luck.

1. Seems you cannot edit the schema in VS2005 to modify the datatype. After messing around, now the project will not open at all.

2. Cannot get the ADS wizard to go anymore, so cannot make .mdb schema change and pull down updated column/table.

3. Thought SQL Server 2005 had a tool you could just open up a .sdf file and change the schema. No luck. At least no intuitive way showed itself after I installed it.

4. Thought SQL Server Express Editition could open such a .sdf file and modify it so installed it. Again, could not figure out how this works either.

I suppose I could start over from scratch and create a new app datasource/dataset in VS2005, but I have done that so many times before, I am getting crabby thinking about doing it again. There must be a better way? Isn't there?

Thank you.

I think I finally have stumbled upon e a crude method to accomplish a change in a sdf file included in a VS project.

0. Assuming there is a Data Connection to the sdf file:

1. I either create a new table in the open the table to edit the table schema.

2. If I want to add or rename a column name, I have to delete all columns down to the insertion point, then add the new column. The data types can be changed at any time. Then one has to add back the columns that were deleted.

3. Close the VS project.

4. Go the to Project directory and copy the sdf file.

5. Reopen the VS project.

6. Delete the Data Connection to the sdf file. If the sdf still exists in the project tree delete it. If the dataset.xsd still exists in the project tree, delete it.

7. Close the project, reopen it.

8. Rename the copied sdf file back to the desired sdf file name.

9. Use the Data->Add New Data Source dialog wizard to browse to the sdf file (the renamed copy).

10. Select tables checkbox.

11. VS wizard should add back in the sdf file Data Connection back into your project, ask you if you want to include the sdf in your project and builds the dataset.xsd objects.

Seems like SQL Svr Management Studio running can interfere.

Remember to check the "Copy to" the device settings.

THere is no doubt a more streamlined way to accomplish an sdf edit but I sure do not know of one.

No comments:

Post a Comment