miller
Posts: 5
|
| Posted: 03/27/2006, 11:26 AM |
|
I am trying to do a custom insert. I have the whole thing working perfect,. but now I want to add the persons IP Address into the table. I have tried many ways but all with no luck, Any guidance would be great below is some info.
SQL
ASP
CCS 3
Current Code(Works perfectly)
Dim Conn
Set Conn = New clsDBConnection2
Conn.Open
Dim Res
Res = CCExecSQL ("INSERT INTO bla_track VALUES (1,1,1,DATEADD( hh , +3, GETDATE()));", Conn, true)
Conn.Close
Set Conn = Nothing
But now I want one of the 1's to be the person Ip Address SO i tried the below code but no luck.
Dim Conn
Set Conn = New clsDBConnection2
Conn.Open
Dim Res
Res = CCExecSQL ("INSERT INTO bla_track VALUES (Request.ServerVariables("REMOTE_HOST"),1,1,DATEADD( hh , +3, GETDATE()));", Conn, true)
Conn.Close
Set Conn = Nothing
Thanks for any help
_________________
Joe Miller
Simpleton |
 |
 |
zolw
Posts: 51
|
| Posted: 03/27/2006, 1:13 PM |
|
Try it like this.
Dim Conn
Set Conn = New clsDBConnection2
Conn.Open
Dim Res
Res = CCExecSQL ("INSERT INTO bla_track VALUES (" & Request.ServerVariables("REMOTE_HOST") & ",1,1," & DATEADD( hh , +3, GETDATE()) & ");", Conn, true)
Conn.Close
Set Conn = Nothing
_________________
Zolw
http://www.xlso.com |
 |
 |
marcwolf
Posts: 361
|
| Posted: 03/27/2006, 2:35 PM |
|
Hmmm..
Now the Request.ServerVariables("REMOTE_HOST") will need to be treated like a string rather than numeric
So it might be this
Dim Conn
Set Conn = New clsDBConnection2
Conn.Open
Dim Res
Res = CCExecSQL ("INSERT INTO bla_track VALUES ('" & Request.ServerVariables("REMOTE_HOST") & "',1,1," & DATEADD( hh , +3, GETDATE()) & ");", Conn, true)
Conn.Close
Set Conn = Nothing
Hope it helps
_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
|
 |
 |
zolw
Posts: 51
|
| Posted: 03/27/2006, 3:51 PM |
|
You are right Marcwolf.
Thanks for correcting my code :)
_________________
Zolw
http://www.xlso.com |
 |
 |
Joe
|
| Posted: 03/28/2006, 11:24 AM |
|
Thanks guys, I ending up going with the following
Dim Conn
Set Conn = New clsDBConnection2
Conn.Open
Dim Res
Res = CCExecSQL ("INSERT INTO bla_track VALUES ('" & Request.ServerVariables("REMOTE_HOST") & "',1,1,DATEADD( hh , +3, GETDATE()) );", Conn, true)
Conn.Close
Set Conn = Nothing
|
|
|
 |
|