Go4Expert

Go4Expert (http://www.go4expert.com/)
-   ASP (http://www.go4expert.com/forums/asp/)
-   -   IP Address of Client Machine (http://www.go4expert.com/forums/ip-address-client-machine-t243/)

amjadhiary 1Feb2005 11:45

IP Address of Client Machine
 
Hello Man,

Iused this code to get the IP address and host name and save it into SQL
db, while submission form using this link below

http://www.hu.edu.jo/support/index.asp

and i got this message

Microsoft OLE DB Provider for SQL Server error '80040e21'

Multiple-step OLE DB operation generated errors. Check each OLE DB status
value, if available. No work was done.

/support/form.asp, line 26



And this is the Source code of it; please could you take a look...A lot of
thanks

'Create Our ServerVariables and Store them to a variable
<% site = Request.ServerVariables("HTTP_REFERER")%>
<% ip = Request.ServerVariables("REMOTE_ADDR")%>
<% host = Request.ServerVariables("REMOTE_HOST")%>
<% strNothing = "Bookmark" %>

<%
if Not site > "" then site= strNothing
Const strConn = "Provider=SQLOLEDB;Data Source='web-amjad';Initial
Catalog='*****';User ID='*****';Password='*****'"
Dim Rs,sql,conn
Set conn=Server.CreateObject("ADODB.Connection")
conn.open(strConn)
Set Rs=Server.createobject("ADODB.Recordset")
If Rs.State = 1 Then Rs.Close
rs.Open "select * from support",conn,1,3
rs.AddNew
rs("req_dept") =Request("req_dept")
rs("req_person") =Request("req_person")
rs("select") =Request("select")
rs("place") =Request("place")
rs("time") =Request("time")
rs("office_no") =Request("office_no")
rs("tel_no") =Request("tel_no")
rs.Fields ("pc_desc") =Request.Form ("pc_desc")
rs("prob_desc") =Request("prob_desc")
rs("notes") =Request("notes")

rs("site") = site
rs("ip") = ip
rs("host") = host
rs.Update
rs.Close

Response.Redirect "thanks.htm"
%>

shabbir 1Feb2005 15:08

Re: IP Address of Client Machine
 
Hello Amjad

The error you are getting is telling that SQL Server is not running properly or SQL server does not have the database correctly done.

The description of error is

Error 80040e21 is an OLE DB error. The error 80040e21 indicates that the field is too small to accept the amount of data you attempted to add. For example, the error 80040e21 may be caused by trying to insert 12 characters into a SQL Server field that is formatted to accept only 10 characters. In this case, you should insert less data.

There is no problem in the code as far as syntax is concerned.

Thanks
Shabbir Bhimani

amjadhiary 1Feb2005 15:31

Re: IP Address of Client Machine
 
Hello Shabbir,

I faced another problem we have a virtual LAN (Virtual IP addresses) and all clients connect to the one server and every body filled the form it will appear on the same IP address of the proxy server, we need to save the actual IP of the client PC

Regards
Amjad

shabbir 1Feb2005 15:46

Re: IP Address of Client Machine
 
The problem is you are trying to get the internet IP of the machine and thats the ip of the router and to get the ip of machine you need the subnet mask so that you know the ip in the local network also.

Thanks
Shabbir Bhimani


All times are GMT +5.5. The time now is 15:15.