Imports System.Text.RegularExpressions
Public Class Sql
Inherits System.Web.UI.Page
Dim cn As New SqlClient.SqlConnection("server=(local);database=crap;trusted_connection=yes")
Dim sProcName As String
Dim colParameters As New Collection
Structure Param
Dim name As String
Dim type As String
Dim size As Int16
Dim Output As Boolean
End Structure
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
UseAddVisitor(Request.UserHostAddress, "SQL.aspx", GetDomain(Request.UserHostAddress))
End Sub
Private Function GetDomain(ByVal ip As String) As String
Dim dm As Net.Dns
Dim he As Net.IPHostEntry
Try
he = dm.GetHostByAddress(ip)
Return he.HostName()
Catch ex As Exception
Return ex.Message
End Try
dm = Nothing
End Function
Private Function UseAddVisitor(ByVal IP As String, ByVal Page As String, ByVal DomainFrom As String) As Boolean
Dim con As New SqlClient.SqlConnection("server=(local);database=lynchdom;trusted_connection=yes")
Dim cmd As New SqlClient.SqlCommand("AddVisitor", con)
Dim da As New SqlClient.SqlDataAdapter(cmd)
With cmd
.CommandType = CommandType.StoredProcedure
With .Parameters
.Add("@IP", SqlDbType.VarChar, 300).Value = IP
.Add("@Page", SqlDbType.VarChar, 3000).Value = Page
.Add("@DomainFrom", SqlDbType.VarChar, 3000).Value = DomainFrom
End With
con.Open()
Try
cmd.ExecuteNonQuery() ' For a stored proc with no records...
Catch ex As Exception
'msgbox ex.message
Response.Write(ex.Message)
Return False
Exit Function
Finally
con.Close()
cmd.Dispose()
End Try
End With
Return True
End Function