Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
3
Erster Beitrag:
vor 2 Jahren, 9 Monaten
Letzter Beitrag:
vor 2 Jahren, 9 Monaten
Beteiligte Autoren:
Paulo Oliveira, Viggo Poulsen, Sam B

Adding new column to db in WebDev 19

Startbeitrag von Sam B am 07.05.2015 22:11

I am working on a WebDev 19 application that I did not originally develop, but that needs to be updated to split a single form field into two distinct fields. This form writes data back to a SQL Express 2014 database, which is connected to via the native SQL access method in WebDev.

I'm not entirely sure of the right procedure for adding new fields. What I've tried so far is adding a field directly to the database through a SQL management application, and then going to WebDev's Analysis tab and selecting Synchronization -> "Update the analysis from the external databases". This generally causes the application to crash, but when I start it back up it does appear the changes have been made.

However, it also makes a number of other changes which I would like to avoid. All I want to do is add in two new columns to the database, but the wizard insists on updating and adding a number of new fields including a lot of "missing_index" fields. The end result is that these updates break the functionality of the form and the queries fail. Prior to making any changes the form functions as expected.

Can anyone provide some insight or assistance in adding new fields in the simplest way possible? Any help is greatly appreciated, thanks in advance.

Antworten:

Hi Sam

I'm not quite sure when using sql Express, but normally I just add extra fields in the analyse and let Webdev do the Work about adding the field in the nessasary databases.

von Viggo Poulsen - am 08.05.2015 13:52
Our approach is never sync from the db to the Analysis, you will have a lot of problems.

We add the new column in the Analysis and we wrote some code to do the changes in the db. this is done by one Windev program, we run this program everytime we install any new version.
The program checks if the Analysis as changed and generate/run some sql code to do the changes.
The easier way to do this is to rename the existing table in the db, let windev create the table with the new definition (hcreation) and use one insert to move the data from the old table definition to the new one(insert into my_table (fld1,fld,fl3,.... select fldx,fldy,fldz,... from my_old_table)

we are doing something more complex, like alter table and so on but you can always start with this simple solution and complete it if your requirements evolve.

von Paulo Oliveira - am 08.05.2015 15:57
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.