I would like have the default value for a feild to be the result of a call to
System.Web.Security.
Membership.GeneratePassword(12,4)How do I implement this?
In a trigger? Do you have sample code?
Thank you very much
Hi,
I think I know what you are asking, and my guess is thatyou may be trying to combine two parts of a solution into one. The default value for a column is a value set for every row in a table, until it is changed by entering another value. So that default value is stored in the database for each row, just as every other column value in the BD. The only difference is that a deafult value is inserted into place in that column row intersection when ever a new row is being entered. The rest of the column values for that row are entered at the time of the creation of that new row. when all the column values have been entered and there are no valiadtion problems, that new row is added to the DB as a transaction (so the complete row is entered - or not entered, as unit).
What your question seems to suggest, is that some value be dynamically selected or calculated, and that value entered into a row of data as a new row is being filled out for entry. That wouldn't be a default value in a DB, but could be a default value in the application that you use to access the DB to enter new data rows in the DB. Do you see the distinction? Onethe DB default value is there whenever and however a new row is added to the DB. The application default value is placed in position to be entered as a column value in a new row for the DB,by the application;as this is an ASP.Net forum, probably by an ASP.Net web app.
If what you want is that a column value in the database (that has just been entered via some application that is used to enter new rows into the DB), be changed (in the DB), whenever a new row of data is entered - and have that value drawn from a call or other source dynamically; then a trigger would be one way to do it. A trigger always works as the result of some specific action (such as the entry of a new row of data). Another way to do it would be to do the call as part of the application - rather than by the DBMS. You can write the app any way you want. You can have it show the value to the user doing the entry, or hide it, or even change whatever they enter to the dynamic value after they enter data, but before the DB is updated with the new row.
The most important thing is that you have clear in your mind what data you want stored in the DB, and which parts of the data entry process you want done in an application outside the DB, and what you want the database management system to take care of. Because data integrity is so important to most databases, there may be DB schema restrictions for data entry/removal/updates. Be very careful about selecting methodes that would circumvent those safegards. BRN..
|||Please help with the following scenario:
A gridview has its datasource bound to an object datasource made of a list of blank data entities such as date, name, amount, etc... The user goes in the grid and enter data in each cell which is a texbox. Now, right after the first row is filled, how can data of that row be put in the next row and display as default data as the cursor moves into it? (All data entered will be submitted by a click of a button at the bottom of the page.) Thanks.
No comments:
Post a Comment