we have a logging system that logs all the hardware and equipment we have and one section of it is where I have to go around and check the lapsafes around the school.
Anyway to cut a long story short In the database I have to manually alter each laptop item in the database to physically change the date to the date that I did the check ( which is a long winded process )
Is there anyway I could have a button on the web front end so that it altered the date for the selected items.
Selected items are items that are checked using a check box so that when I click the button it changes the date to todays date ( that does not change )
laptop 1 checkbox1 06-february-2008
laptop 2 checkbox2 06-february-2008
laptop 3 checkbox3 06-february-2008
Alter date <-- click this button so that it puts the above dates in the date column to 06-february-2008
so that it does not link to the system clock so that when I come back tommorow or any time after today the date is still 06-february-2008
and not 07-february-2008 or greater then that ?
The SQL command you want is something like
but with out knowing more details, I can't really help any more (table name, schema, sql server type, client language, etc).
If you substitute the date in the above example with GetDate() it would use todays date rather than having to manually edit the date value each time or if you want it to always show the particular date use the above as written.
There are a whole slew of Date parameter variables (exact syntax depends on version of SQL your using) that should allow you to get exactly what date format you want too.
getDate works in MSSQL, the my-sql equivlent seems to be curdate(). http://dev.mysql.com/doc/refman/5.0/...functions.html.
Originally Posted by JohnCondon
But if your doing it from a front-end it maybe easier to use that to generate the current date.
To address another point of the OPs, once you write it to the database, it won't automatically update to the system clock so you shouldn't have to worry about that.
so going from the above info if i used :
Is that the correct syntax
assuming that latoptable is the name of the table and where does each [laptopid] come from ?
also what is laptop ?
taking into consideration that for example in one lapsafe in the database it pulls up the laptops from the science lapsafe, this has 16 laptops in it.
So there will be 16 check boxes ( each check box on the same line as each laptop )
laptop one -- [c]
laptop two -- [c]
where [c] is a physical checkbox where I click the mouse and it checks or unchecks the checkbox.
This is all getting rather abstract but in my example laptop was the id of the database record about the laptop I suppose really it should have been in quotes ''.
[laptopid] would be the unique identifer (primary key) field of the laptop record in the table laptoptable.
Talking about checkboxes isn't that helpful as you need to know what's going on in the underlying database. A checkbox could imply a boolean field so it would be something like
update ...... SET [booleanFieldThatIsSourceOfCheckbox]='True';
But you've mentioned date so I think you need to take a look at the underlying database tables. If you look at the state of a specific record first then do the check box and see how the record changes that should give you a good start.