Topic: avoid a particular a record from deleting it from a tablegrid
Can I avoid a particular a record from deleting it from a tablegrid ?
My Visual Database → Script → avoid a particular a record from deleting it from a tablegrid
Can I avoid a particular a record from deleting it from a tablegrid ?
Hello,
I use a trick for records or data I don't want the user to delete : I had a boolean field called "can_delete" to a table, with default value set to 1 (true) and I set this value to 0 for the field marked as "undeletable".
Then it's just a matter of adding "AND can_delete=0" to your delete queries.
Hope it helps
Cheers
Mathias
can you send me an example ? I am not a good programer.
Hello mathmatou
Ahh !! It's an old trick programmer and it is still effective !!
JB
ok but , can anyone send me an exaple to understand how to do that ?
ok but , can anyone send me an exaple to understand how to do that ?
Example for you:
Dimitry,
Thanks for your quick response
this is the one what I was asking for.
Is there any manual for the syntax of the SQLExecute and where should I use the dots
( symbol ' )
Hello v_posidis,
Forget about the SQLExecute, this is "just" the command that launches SQL Queries.
What you should focus on in the SQL syntax itself. You can find references all avor the internet, but here is a good (not the only one) source with examples :
http://www.w3schools.com/sql/sql_syntax.asp
In MVD, queries are triggered by the SQLExecute command, followed by the query itself like this :
SQLExecute('SOME SQL QUERY');
The "tricky" part is that, sometimes, you want to add variables to your queries, beeing text variables are integer variables.
Most of the time, you'll have to momentarely close theSQL syntx to add you variables and then reopen the query. something like this :
SQLExecute('SELECT name FROM customers WHERE name="'+mathias+'" AND id=5');
the " is to tell SQL you are looking for TEXT
the ' is to "close" the QUERY and begin the variable declaration
the + sign is the concatenate sign telling the query it is not finished and you are adding the variable there
then, after variable declaration, you have to do the same sequence but in reverse + and ' and finally "
Don't forget the LAST ' before the ) and ;
I hope I did not make any mistakes inmy example, those signs are confusing and a very small on my laptop screen for my "old eyes"
Tell me : are you by any chance trying to protect some records because, when th eproject is first launched, you have errors if you tables are empty ? Are is it something different ?
Cheers
Mathias
Thanks for the help
* it works fine with the protected records. The idea was to have 3 records standard that no one could delete them. So I have those 3 records from the beginning in the tablegrid and the combobox.
Thanks again.
My Visual Database → Script → avoid a particular a record from deleting it from a tablegrid
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi