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;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.SqlTypes;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
System.Data.OleDb.OleDbConnection Conn = new System.Data.OleDb.OleDbConnection();
Conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/Users/Yo/Documents/Prueba.accdb;Persist Security Info=False";
try
{
Conn.Open();
MessageBox.Show("Conexion a la base de datos ok");
}
catch (Exception ex)
{
MessageBox.Show("Fallo al conectar la base de datos");
}
finally
{
Conn.Close();
}
}
}
}
No hay comentarios:
Publicar un comentario