Join 150,075 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,799 people online right now. Registration is fast and FREE... Join Now!
Hello, I managed to execute queries like SELECT * FROM a, but I cannot execute the ones with ALTER, because the following error appear: Cannot execute data definition statements on linked data sources.
I read something about Back-end & Front-end queries(they are different), but at end I didn't succeed. I've tried 15 different source codes and each with problems. The last I tried is:
The problem with it is that it is used only for new table to the current database and I cannot decide how to change it so it can be used to update a database, which already exists before that moment. The error in this case is "Database already exists", which is enough proof that the script tries to create the database, not to update it.
Okay, I will tell you. This .mdb is created by one programm with some data. I have to add 8 more columns somehow and not on hand! So it should be at run-time. We have to check if they already exist and if not, they should be created. Then I have to use these fields and add additional data with my application.
have to add 8 more columns somehow and not on hand! So it should be at run-time. We have to check if they already exist and if not, they should be created. Then I have to use these fields and add additional data with my application.
Create another table, like procProductsListEx, with the same primary keys as procProductsList, but no autoincrement. Put any extra columns in there that you need. Then just add all data to that table.
Won't be that very slow? I mean transferring all that data which exists before the operation... This is a kind of sollution but I think there should be a way to create "ALTER" queries. It can't be impossible! Thanks for the sollition, anyway. If nothing appears, I will try this but I prefer something else, using ALTER or alternative way.
If you're altering a table to add columns, then those columns are empty. If you create a new table, it's empty. If you add data to the new columns, you update. If you add data to the new table, you update or insert. I'm not sure how it would be any more or less slow.
If complete flexibility, make a table with three columns: ExtendedData(ParentTable, ParentPK, Key, Value). Make the key and value varchar. Use them to add or drop extended data from an existing schema as you like.
ALTER ADD COLUMN, btw, will affect the entire table. It in effect creates a new table copies everything in, drops the old table, and then renames the new table. It's probably one of the slowest DDL operations you can do.
So, if I want to create additional columns to the table, I should use the method of creating a new table, creating the previous columns + the ones I want to add + all the data? Okay, thank you for the help. I will try everything tomorrow and if problems appear, I will write.