CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Custom INSERT into SQL with IP Address

Print topic Send  topic

Author Message
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
View profile  Send private message
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
View profile  Send private message
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!!!!!!!
View profile  Send private message
zolw


Posts: 51
Posted: 03/27/2006, 3:51 PM

You are right Marcwolf.

Thanks for correcting my code :)
_________________
Zolw
http://www.xlso.com
View profile  Send private message
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     
  
  

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.