I have given valuable advise from here
But as subject title says I am receiving error in the btnLogin method, related to my previous question but really the same problem
In first login method, you override the commandtext, by setting it twice:
cmd.CommandText = "INSERT INTO LoginLogTable (UserName, LoggedInDate, LoggedInTime) VALUES (@UserName, @LoggedInDate, @LoggedInTime)";
cmd.CommandText = "SELECT @ID = @@IDENTITY";
In 'update 2', you are concatting the SELECT-statement right after the INSERT-statement, resulting in the following SQL:
INSERT INTO LoginLogTable (UserName, LoggedInDate, LoggedInTime) VALUES (@UserName, @LoggedInDate, @LoggedInTime)SELECT @ID = @@IDENTITY
You must set an ';' at the end of the INSERT-statement, before the 'SELECT'.
And btw. use SCOPE_IDENTITY(), instead of @@IDENTITY, see http://msdn.microsoft.com/en-us/library/ms190315.aspx and SQL: How to get the id of values I just INSERTed?
Also, here is an similar question, showing the correct way to execute the command: How to get last inserted id?