private void button1_Click(object sender, EventArgs e) { if ((Ime_korisnik.Text.Count() != 0) && (Prezime_korisnik.Text.Count() != 0)) { OracleConnection con = new OracleConnection(); con.ConnectionString = "User Id=DBA_20122013L_GRP_038;Password=9910620;Data Source=(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)))(CONNECT_DATA=(SID=ORCL)))"; con.Open(); OracleCommand getUser = new OracleCommand(); getUser.Connection = con; getUser.CommandText = "SELECT * FROM KORISNICI WHERE IME = '" + Ime_korisnik.Text + "' AND PREZIME = '" + Prezime_korisnik.Text + "'"; OracleDataReader reader = getUser.ExecuteReader(); bool ima = true; while (reader.Read()) { ima = false; string tmpID = reader[0].ToString(); string tmpName = reader[1].ToString(); string tmpLastName = reader[2].ToString(); string tmpAdress = reader[3].ToString(); string tmpPhone = reader[4].ToString(); string tmpEmbg = reader[5].ToString(); string tmpPopust = reader[6].ToString(); Korisnici korisnik = new Korisnici(tmpID, tmpName, tmpLastName, tmpAdress, tmpPhone, tmpEmbg, tmpPopust); textBox3.Text = korisnik.EMBG; textBox4.Text = korisnik.address; textBox5.Text = korisnik.phone; textBox7.Text = korisnik.popust; } con.Close(); if (ima) { MessageBox.Show("Корисникот не постои!"); } } else { MessageBox.Show("Внесете име и презиме!"); } }