2.1 Kutubxonani avtomatlashtirtish tizmi
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
KUTUBXONA KUTUB = new KUTUBXONA();
private void kUTUBXONAToolStripMenuItem_Click(object sender, EventArgs e)
{
KUTUB.Show();
}
private void label1_Click(object sender, EventArgs e)
{
Application.Exit();
}
Form2 ochil = new Form2();
private void tAHRIRLASHToolStripMenuItem_Click(object sender, EventArgs e)
{
ochil.Show();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
KUTUBXONA KUTUB = new KUTUBXONA();
private void kUTUBXONAToolStripMenuItem_Click(object sender, EventArgs e)
{
KUTUB.Show();
}
private void label1_Click(object sender, EventArgs e)
{
Application.Exit();
}
Form2 ochil = new Form2();
private void tAHRIRLASHToolStripMenuItem_Click(object sender, EventArgs e)
{
ochil.Show();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication4
{
public partial class KUTUBXONA : Form
{
SqlConnection sqlConnection = null;
SqlDataAdapter sqlDataAdapter = null;
DataTable table = new DataTable();
public KUTUBXONA()
{
InitializeComponent();
}
private void KUTUBXONA_Load(object sender, EventArgs e)
{
Load_data();
}
public void Load_data()
{
try
{
sqlConnection = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=c:\users\abdumajid\documents\visual studio 2012\Projects\WindowsFormsApplication4\WindowsFormsApplication4\Database1.mdf;Integrated Security=True");
sqlDataAdapter = new SqlDataAdapter("SELECT * FROM [Table]", sqlConnection);
sqlDataAdapter.Fill(table);
dataGridView1.DataSource = table;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void label2_Click(object sender, EventArgs e)
{
this.Hide();
}
}
}
Do'stlaringiz bilan baham: |