Author |
Topic |
DURGESH
Posting Yak Master
105 Posts |
Posted - 2008-10-13 : 07:44:53
|
hi all,i want to insert a record in tbl along with ip address infocan anybody help me to solve this issuethanks in advanceRegardsDurgesh J |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-13 : 07:46:23
|
Ip address info is taken from where?Client? server? other? E 12°55'05.63"N 56°04'39.26" |
 |
|
DURGESH
Posting Yak Master
105 Posts |
Posted - 2008-10-14 : 05:00:40
|
hifrom client machine |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-14 : 05:13:32
|
Send the client IP address as a parameter to the stored procedure. E 12°55'05.63"N 56°04'39.26" |
 |
|
DURGESH
Posting Yak Master
105 Posts |
Posted - 2008-10-14 : 05:17:49
|
hi peso,i want to enter a record in a table whenever a client perform some DML operation along with ip address of his machine |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-14 : 05:23:46
|
You want some logging on specific tables?How about you describe your scenario (what you want to do), including your problem, with plain english?Then we may be able to help.Getting only fragments of your full problem is NOT helpful. E 12°55'05.63"N 56°04'39.26" |
 |
|
DURGESH
Posting Yak Master
105 Posts |
Posted - 2008-10-14 : 05:35:11
|
hi peso,i want to know the client who had performed delete,insert,update operation on tables |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-14 : 05:41:28
|
In SQL Server 2000 you must create an AFTER TRIGGER on each of the tables you want to log.You can use GETDATE() and SUSER_SNAME() for example to log which user did what and when. E 12°55'05.63"N 56°04'39.26" |
 |
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2008-10-14 : 05:48:38
|
I have one used this to get the ip information if that is any help, and then you could enclose this in a trigger with an added insert statment at the bottom perhapsDeclare @ipLine varchar(200)Declare @pos intDeclare @ip varchar(30)set nocount onset @ip = NULLCreate table #temp (ipLine varchar(200))Insert #temp exec master..xp_cmdshell 'ipconfig'select @ipLine = ipLinefrom #tempwhere upper (ipLine) like '%IP ADDRESS%' if (isnull (@ipLine,'***') != '***')begin set @pos = CharIndex (':',@ipLine,1); set @ip = rtrim(ltrim(substring (@ipLine , @pos + 1 , len (@ipLine) - @pos)))end |
 |
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-10-14 : 05:49:12
|
quote: Originally posted by DURGESH hifrom client machine
This is quite straightforward to implement in either classic ASP or .net ( vb.net or c#)All depends on which front end you are using. Then you can easily pass it to the db |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-14 : 06:02:32
|
Neil, does the code snippet get the CLIENT ip-address or the server ip-address? E 12°55'05.63"N 56°04'39.26" |
 |
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-10-14 : 06:14:47
|
Its best, DURGESH confirms which frontend he/she is using since. He wants the client's IPIt can be done with one line of code in either c# or classic ASP |
 |
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-10-14 : 06:23:28
|
In Classic ASP you useIP = request.ServerVariables("REMOTE_ADDR") in .net using c# you usestring IP = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString(); Then you can pass the variable to your database via your SP |
 |
|
|