Advertisement
Guest User

form2

a guest
Apr 24th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.66 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.Data.OleDb;
  11.  
  12. namespace vjezba_baza
  13. {
  14.     public partial class Form2 : Form
  15.     {
  16.         User odabraniUser;
  17.         OleDbConnection con = new OleDbConnection("Provider=OraOLEDB.Oracle; OLEDB.NET=True; DATA SOURCE = veza1; PERSIST SECURITY INFO=True;USER ID = MHRANJ; PASSWORD = DfhI51aB461");
  18.         public Form2()
  19.         {
  20.             InitializeComponent();
  21.         }
  22.         public Form2(User OdabraniUser)
  23.         {
  24.             InitializeComponent();
  25.             odabraniUser = OdabraniUser;
  26.         }
  27.         private void Form2_Load(object sender, EventArgs e)
  28.         {
  29.             UserIdText.Text = odabraniUser.userID;
  30.             con.Open();
  31.             dataGridView1.Rows.Clear();
  32.             string querry = "select * from PRODUCT where LAGER_VALUE>0";
  33.             OleDbDataAdapter adapter = new OleDbDataAdapter(querry, con);
  34.             DataTable dt = new DataTable();
  35.             adapter.Fill(dt);
  36.             OleDbCommand cmd = new OleDbCommand();
  37.             cmd.ExecuteNonQuery();
  38.             dataGridView1.DataSource = dt;
  39.             con.Close();
  40.         }
  41.  
  42.         private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
  43.         {
  44.             if (dataGridView1.Rows.Count > 0)
  45.                 NazivTxt.Text = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
  46.         }
  47.  
  48.         private void button1_Click(object sender, EventArgs e)
  49.         {
  50.  
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement