i have a store procedure for user login which i am calling in my ASP.NET code.And now i want that when user log, the IP Address of that user's system and date time of system will get saved into another table.i should be saved in 126.96.36.199 format. i have gone through your article but thats not fullfiling my need.please help me how can i do this.i tried this code which is not working. one thing i m not understanding as i am not very usuall with store procedure coding.what does exec dbo.xp_cmdshell'ipconfig' stand for.i mean what is "xp_cmdshell" and which dbo it is executing.
My code is:
ALTER PROCEDURE [dbo].[User_Login]
@ipadress varchar(40) output,
@RS int output
SELECT @RS = COUNT(*) FROM Users WHERE username=@username AND pword=@pword
DECLARE @ipLine varchar(200)
DECLARE @pos int
SET NOCOUNT ON
SET @ipaddress = NULL
CREATE TABLE LoginDetail(ipLine varchar(200))
INSERT INTO LoginDetail exec dbo.xp_cmdshell'ipconfig'
SELECT @ipLine = ipLine FROM LoginDeatil WHERE upper (ipLine) LIKE '%IP ADDRESS%'
IF (ISNULL (@ipLine,'***') != '***')
SET @pos = CharIndex(':',@ipLine,1);
SET @ipaddress = RTRIM(LTRIM(SUBSTRING (@ipLIne,@pos + 1,
DROP TABLE LoginDeatin
SET NOCOUNT OFF
i have to call this SP in my ASP.NET code.i dont want to display ip address and date time in front end.Only want to store ip and date time.