sql komutu ile count alarak maximum değeri buldurabilirsin
Hocam, dediğiniz sistemi;
Select COUNT(GrsGuc) From ConfigTable
SELECT GrsGuc FROM ConfigTable Max
İki şekilde'de denediğimde aşağıdaki gibi bir hata aldım.
*************************************************
Bir de şöyle bir kodum var. Bunda buluyor fakat sürekli ilk sıradakini ekliyor ve kaç tane diye bir değer belirttiğim için 4 RadioButton ekliyor.
private void button1_Click(object sender, EventArgs e)
{
SqlCommand veri = new SqlCommand("SELECT Name FROM Locations", baglan);
SqlDataReader oku;
baglan.Open();
oku = veri.ExecuteReader();
while (oku.Read())
{
// string[] stringArray = new string[3];
System.Windows.Forms.RadioButton[] radioButtons = new System.Windows.Forms.RadioButton[5];
for (int i = 0; i < 4; ++i)
{
//stringArray[0] = (oku["Name"].ToString());
radioButtons[i] = new RadioButton();
// dataGridView1.DataSource = oku["Name"].ToString();
radioButtons[i].Text = oku["Name"].ToString();
radioButtons[i].Location = new System.Drawing.Point(20, 20 + i * 20);
this.Controls.Add(radioButtons[i]);
}
}
oku.Close();
baglan.Close();
}