Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Data.OleDb;
- using System.Windows.Forms;
- namespace WindowsFormsApplication1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- dataGridView1.ColumnCount = 6;
- dataGridView1.Columns[0].HeaderText = "cod_cl";
- dataGridView1.Columns[1].HeaderText = "sala";
- dataGridView1.Columns[2].HeaderText = "profil";
- dataGridView1.Columns[3].HeaderText = "specialitate";
- dataGridView1.Columns[4].HeaderText = "diriginte";
- dataGridView1.Columns[5].HeaderText = "nr_elevi";
- //stringul de conectare
- string connstring =@"Provider-Microsoft.ACE.OLEDB.12.0; Data Source=scoala11a.accdb";
- //stringul de interogare
- string sql=@"select * from Clase";
- //declarare variabilele conexiune si data reader
- OleDbConnection conn=null;
- OleDbConnection reader=null;
- //cream conexiunea
- using (conn=new OleDbConnection(connstring))
- { conn.Open();
- //se executa interogarea
- OleDbCommand cmd=new OleDbCommand(sql,conn);
- reader= cmd.ExecuteReader();
- //declaram un tablou de stringuri care retine val. unui rand din tabela
- string[] r=null;
- //met. Read() avanseaza reader la un rand nou
- while(reader.Read())
- {r=new string[6] {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement