Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void osvezi()
- {
- string k = "select top 1 GlumacID from Glumac order by GlumacID desc";
- try
- {
- int poslednji = 0;
- con.Open();
- SqlCommand cmd = new SqlCommand(k, con);
- SqlDataReader dr = cmd.ExecuteReader();
- if (dr.Read())
- {
- poslednji = Convert.ToInt32(dr[0].ToString());
- }
- dr.Close();
- // MessageBox.Show(poslednji.ToString());
- for (int i = 0; i < poslednji + 1; i++)
- {
- string k2 = "select * from Glumac where GlumacID=" + i;
- SqlCommand cmd2 = new SqlCommand(k2, con);
- SqlDataReader dr2 = cmd2.ExecuteReader();
- while (dr2.Read())
- {
- richTextBox1.Text += dr2[0].ToString() + " " + dr2[1].ToString() + " " + dr2[2].ToString() + " " + dr2[3].ToString() + " " + dr2[4].ToString() + " " + "\n";
- }
- dr2.Close();
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- throw;
- }
- finally
- {
- if (con.State == ConnectionState.Open) con.Close();
- }
- }
Add Comment
Please, Sign In to add comment