|
c# |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
namespace WindowsFormsApplication18
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection VeriTabaniBaglantisi = new OleDbConnection("Provider=Microsoft.Ace.OleDb.12.0;Data Source = ProgramlamaHocam.accdb");
try
{
if (!Convert.ToBoolean(VeriTabaniBaglantisi.State))
{
VeriTabaniBaglantisi.Open();
}
OleDbCommand TabloOlustur = new OleDbCommand("Create Table " + textBox1.Text,
VeriTabaniBaglantisi);
TabloOlustur.ExecuteNonQuery();
MessageBox.Show("İşlem Tamamlandı. " + textBox1.Text + " isimli tabloyu oluşturdunuz...",
"Başarılı");
}
catch (Exception hata)
{
MessageBox.Show(hata.Message.ToString(), "Hata..!", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
finally
{
if (Convert.ToBoolean(VeriTabaniBaglantisi.State))
{
VeriTabaniBaglantisi.Close();
}
}
}
}
}
0 yorum :
Yorum Gönder