2
Answers

How to create different license keys for my Product

Photo of Praveen Kumar

Praveen Kumar

14y
2.4k
1
Hi Friends,

I have created a windows application using c#.net in Visual Studio 2008 and also created a setup for it and now i want to distribute it to my customers. So to overcome the problem of copyright or piracy, i wanted to create license keys for my product, so please help me how can i achieve this to my product.

For example: When we are installing windows os on any pc it asks for a key right? I want this functionality to my project. Please help me....

Thanks in advance.  

Answers (2)

0
Photo of Khan Abrar Ahmed
NA 5.8k 200k 10y
Hi try this


namespace Attendance_Application
{
    public partial class bwaapp : Form
    {
        string constring = "SERVER='localhost';DATABASE='bwiitm';UID='root';PASSWORD='';";
        MySqlConnection con;
        DataSet ds = new DataSet();
        string coursecombo;
        string semcombo;
        string divcombo;
        public bwaapp()
        {
            InitializeComponent();
        }
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex > -1)
            {   
                coursecombo = comboBox1.SelectedItem.ToString();
                con = new MySqlConnection(constring);

 con = new MySqlConnection(constring);
                MySqlDataAdapter daroll = new MySqlDataAdapter("SELECT count(rollno)FROM attendance where course='" + coursecombo + "'and sem='" + semcombo + "'and division='" + divcombo + "'", con);
                daroll.Fill(ds, "roll_no");
                label9.Text=ds.Tables["roll_no"].Rows[0][0].ToString()+" Students";
                label9.ForeColor = Color.Red;

            }
            else
            { }
        }
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox2.SelectedIndex > -1)
            {
                semcombo = comboBox2.SelectedItem.ToString();
            }
        }
        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox3.SelectedIndex > -1)
            {
                divcombo = comboBox3.SelectedItem.ToString();

 con = new MySqlConnection(constring);
                MySqlDataAdapter daroll = new MySqlDataAdapter("SELECT count(rollno)FROM attendance where course='" + coursecombo + "'and sem='" + semcombo + "'and division='" + divcombo + "'", con);
                daroll.Fill(ds, "roll_no");
                label9.Text=ds.Tables["roll_no"].Rows[0][0].ToString()+" Students";
                label9.ForeColor = Color.Red;
            }
            try
            {
                con = new MySqlConnection(constring);
                MySqlDataAdapter daroll = new MySqlDataAdapter("SELECT count(rollno)FROM attendance where course='" + coursecombo + "'and sem='" + semcombo + "'and division='" + divcombo + "'", con);
                daroll.Fill(ds, "roll_no");
                label9.Text=ds.Tables["roll_no"].Rows[0][0].ToString()+" Students";
                label9.ForeColor = Color.Red;
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERROR: " + ex, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (con != null)
                {
                    con.Dispose();
                }
            }
        }