number generator in c# not random numeber

Mike Askew commented: Poorly written -1
ChrisHunter commented: stupidly vague description of problem -1

Recommended Answers

Good for you.

In what context are you trying to use the random number generator, what errors are you getting and do you want help or are you just stating that it doesnt work ?

Jump to Post

All 3 Replies

Good for you.

In what context are you trying to use the random number generator, what errors are you getting and do you want help or are you just stating that it doesnt work ?

If it's not random, you need to specify what rules have to be in place for generating each number. For example, is it a sequence number? A number based on the date and time? "Not random" is not helpful; the best one can offer is this:

// Generate N "not random" numbers
for (int i = 0; i < n; i++)
    Console.WriteLine(n);
private void Form1_Load(object sender, EventArgs e)
        {
            con.ConnectionString = "server=MANI;uid=sa;password=sql;database=pro";
            con.Open();
            cmd.Connection = con;
            string sql;
            sql = "select MAX(pno)from product=" + textBox1.Text;
            cmd.CommandText = sql;
            cmd.ExecuteNonQuery();
             if (dr.Read())
            {
                textBox1.Text = dr.GetValue(1).ToString() + 1;
            }
            else
            {
                MessageBox.Show("rer");
            }
            dr.Close();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.