sqlite ve access denedim fakat tablo başlıkları geliyor ama içindeki veriler gelmiyor.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Data.OleDb;
using DevExpress.XtraPrinting;
using System.Drawing.Printing;
using DevExpress.LookAndFeel;
using DevExpress.XtraBars.Navigation;
using DevExpress.XtraSplashScreen;
using System.Data.SQLite;
using DevExpress.XtraWaitForm;
namespace DepoProgramı
{
public partial class BilgisayarKasasi : DevExpress.XtraEditors.XtraForm
{
//OleDbConnection conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Application.StartupPath + @"\Data.accdb");
//OleDbCommand command;
//OleDbDataAdapter da;
// private BindingSource bindingSource = null;
//private OleDbCommandBuilder oleCommandBuilder = null;
//DataTable dataTable = new DataTable();
//DataTable tablo = new DataTable();
SQLiteConnection bag = new SQLiteConnection("Data Source=Data.db;Version=3;Read Only=False;");
private SQLiteCommand command;
SQLiteDataAdapter da;
private BindingSource bindingSource = null;
private SQLiteCommandBuilder oleCommandBuilder = null;
DataTable dataTable = new DataTable();
DataTable tablo = new DataTable();
public BilgisayarKasasi()
{
InitializeComponent();
}
private void DataBind()
{
gridControl1.DataSource = null;
dataTable.Clear();
String queryString1 = "SELECT * FROM CihazEkleBilgisayarKasasi";
SQLiteConnection connection = new SQLiteConnection(bag);
connection.Open();
SQLiteCommand command = connection.CreateCommand();
command.CommandText = queryString1;
try
{
da = new SQLiteDataAdapter(queryString1, connection);
oleCommandBuilder = new SQLiteCommandBuilder(da);
da.Fill(dataTable);
bindingSource = new BindingSource { DataSource = dataTable };
gridControl1.DataSource = bindingSource;
gridView1.Columns[0].Visible = false;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void navbarYeniEkle_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
{
SplashScreenManager.ShowForm(typeof(WaitForm));
var cihazekle = new YeniCihazEkle();
cihazekle.Show();
Hide();
SplashScreenManager.CloseForm();
}
private void btnExit_Click(object sender, EventArgs e)
{
if (XtraMessageBox.Show("Programı Kapatmak İstiyor musunuz ? ", "Dikkat", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Application.Exit();
}
}
private void btnMax_Click(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Normal)
{
WindowState = FormWindowState.Maximized;
}
else
{
WindowState = FormWindowState.Normal;
}
}
private void btnMin_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Minimized;
}
private void navbarAnaMenu_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
{
var ana = new AnaMenu();
ana.Show();
Close();
}
private void BilgisayarKasasi_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'dataDataSetKasa.CihazEkleBilgisayarKasasi' table. You can move, or remove it, as needed.
// this.cihazEkleBilgisayarKasasiTableAdapter.Fill(this.dataDataSetKasa.CihazEkleBilgisayarKasasi);
DataBind();
}
private void navbarSil_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
{
gridView1.DeleteRow(gridView1.FocusedRowHandle);
cihazEkleBilgisayarKasasiTableAdapter.Update(dataDataSetKasa.CihazEkleBilgisayarKasasi);
}
private void navbarKaydet_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
{
try
{
Validate();
cihazEkleBilgisayarKasasiBindingSource.EndEdit();
cihazEkleBilgisayarKasasiTableAdapter.Update(dataDataSetKasa.CihazEkleBilgisayarKasasi);
XtraMessageBox.Show("Kayıt Başarılı !", "Durum", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception)
{
XtraMessageBox.Show("Kayıt işlemi Başarısız !", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void navbarExcel_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
{
var save = new SaveFileDialog();
if (save.ShowDialog() == DialogResult.OK)
{
gridView1.ExportToXlsx(save.FileName + ".xlsx");
}
}
private void navbarYazdir_ElementClick(object sender, DevExpress.XtraBars.Navigation.NavElementEventArgs e)
{
var link = new PrintableComponentLink(new PrintingSystem());
link.Component = gridControl1;
link.PrintingSystem.Document.AutoFitToPagesWidth = 1;
link.PaperKind = PaperKind.A4;
link.Landscape = true;
link.ShowPreview();
}
}
}