Author: dalila | Posted on: 2/22/2010 8:01:32 AM | Views : 801

Hi everyone, 
Does anyone have any idea how to do the following code snippet i posted below in web method?



protected void Page_Load(object sender, EventArgs e) { // Get the hostname string myHost = System.Net.Dns.GetHostName(); // Get the IP from the host name //string myIP = System.Net.Dns.GetHostEntry(myHost).AddressList[0].ToString(); string connect = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=C:\\inetpub\\wwwroot\\Request\\App_Data\\TV.mdb"; string query = "SELECT COUNT(IPAddress) FROM Request WHERE IPAddress = ?"; int result = 0; using (OleDbConnection conn = new OleDbConnection(connect)) { using (OleDbCommand cmd = new OleDbCommand(query, conn)) { cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("IPAddress", myHost) ...

Go to the complete details ...