473,473 Members | 4,257 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Update Last Record in SQL Server 2005

Adithya Adi
12 New Member
Table name: shift_Login
columns:ID, Username, TimeLogin, TimeLogoff

Username and password is Checked from another table.
1.ID is AutoNumber,
2.Username is taken from the login form directly(Text Box)
3.TimeLogin is taken (current time) from the button click

only one can login at a time.
user will logoff after all the process.

when logging out - TimeLogoff should be entered directly to the shift_login table(current time).

anyway TimeLogoff will be entered in the last row.

Can u please send me the query to update the last row in the table.
Dec 7 '11 #1
2 1834
gpl
152 New Member
In the context of an SQL table, last row is meaningless

however, this should do what you ask
Expand|Select|Wrap|Line Numbers
  1. Select Max(TimeLogoff)
  2. From shift_Login
  3.  
Dec 7 '11 #2
Adithya Adi
12 New Member
thanks for the code.. its not that I meant.. but that was enough.. I got the idea to do from your code..
The code actually need for me was ------
"update ShiftLogin set shftlgn_time_off = 'xxxxxxxx' where shftlgn_empid = (Select Max(shftlgn_empid) From ShiftLogin)"
Dec 9 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mihaly | last post by:
I want to update a record into a table in SQL Server 2000 database from C#. This table is used concurently for other users too, and I want to be sure that from the read of record to the update no...
4
by: msilva10 | last post by:
In my application I have a table called Tenant and I have another table called Leases. As I add a new Lease to a Tenant I have a Yes/No Field that defaults to yes when I add a new Lease. But I need...
7
by: Boxwar | last post by:
Hi, I am creating a Python function which contains a SQL string. When the function is loaded, the SQL table must be updated with the values from my program. This is all done. Though I'm stuck...
1
by: Zeljko Bilandzija | last post by:
Hello! I have a problem, and I looking for help if someone can handle this. I use asp.net 2.0, and I create web site which support users from internet (Web Site Administration Tool) and with...
1
by: Tony | last post by:
I've recently bought a laptop with Windows XP Pro SP2. It keeps trying to install an MS update for SQL Server 2005 Express, but failing (with error 0x2B22). What I'm wondering is, why is this...
2
by: ahmedlasheen | last post by:
hello every body when iam trying to delete the last record in DGV this erro appears "Input string was not in a correct format." this error appears only when i am trying to delete the last record....
3
by: Bill Eddings | last post by:
I am new to the site so pardon me if I do things wrong until I learn. Though this question is not specifically to ACCESS it is very near to it so I am posting it hoping I get a reply. What I want...
1
by: rob41 | last post by:
This is the code and I'm getting a syntax error at the From statement: Msg 156, Level 15, State 1, Line 33 Incorrect syntax near the keyword 'FROM'. Any suggestions on what've done wrong? ...
0
by: chis101 | last post by:
I'm trying to update a SQL Server 2005 database with data entered by the user into textboxes. Here is the code I am using: namespace MLMLocalAdmin { public partial class...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.