1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

IP Address of Client Machine

Discussion in 'ASP' started by amjadhiary, Feb 1, 2005.

  1. amjadhiary

    amjadhiary New Member

    Joined:
    Nov 29, 2004
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    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"
    %>
     
    Last edited by a moderator: Feb 1, 2005
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    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
     
  3. amjadhiary

    amjadhiary New Member

    Joined:
    Nov 29, 2004
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    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
     

Share This Page