I've created an application that is pretty widely used and would like to get an idea of just how many people use it and how often.
How can I implement something that will do that?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Dorababu MekaRank #457 · 5.5K reputationPosted Jan 11, 2013, 9:10 PM EST
Form_Load()
{
get the Ip if needed and check for the IP already exists in db or not
if not exists make a count variable to 1 and to 2,3 and so on when ever user open the solution
}
private void frmIP_Load(object sender, EventArgs e)
{
string machineName = Environment.MachineName;
string ipAddress = Dns.GetHostAddresses(Environment.MachineName)[0].ToString();
int icnt = 0;
MySqlConnection con = new MySqlConnection("server=172.16.18.31;database=efdb;uid=root;pwd=server@123");
MySqlCommand cmd = new MySqlCommand("select count from tblIpInfo where machineName='" + machineName + "'", con);
if (con.State == ConnectionState.Closed)
{
con.Open();
}
MySqlDataAdapter da = new MySqlDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows.Count != 0)
{
if (Convert.ToInt16(ds.Tables[0].Rows[0]["count"]) != 0)
{
icnt = Convert.ToInt16(ds.Tables[0].Rows[0]["count"]);
icnt++;
cmd.Parameters.Clear();
cmd = new MySqlCommand("update tblIpInfo set count='" + icnt + "' where ipAddress='" + ipAddress + "'", con);
if (con.State == ConnectionState.Closed)
{
con.Open();
}
cmd.ExecuteNonQuery();
}
}
else
{
icnt++;
cmd.Parameters.Clear();
cmd = new MySqlCommand("insert into tblIpInfo values('" + ipAddress + "','" + machineName + "','" + icnt + "')", con);
if (con.State == ConnectionState.Closed)
{
con.Open();
}
cmd.ExecuteNonQuery();
}
}
Neha SharmaRank #569 · 4.3K reputationPosted Jan 11, 2013, 11:37 PM EST
You can make your database live and can install setup (given by dora sir) it ll work .
Thanks.
Matthew Despain3 reputationPosted Jan 12, 2013, 5:49 PM EST
Dorababu MekaRank #457 · 5.5K reputationPosted Jan 12, 2013, 10:03 PM EST
http://msdn.microsoft.com/en-us/library/system.net.iphostentry.addresslist%28VS.80%29.aspx
http://stackoverflow.com/questions/1059526/get-ipv4-addresses-from-dns-gethostentry