Rubi Begum

Rubi Begum

  • NA
  • 7
  • 5.6k

Hi,there is

Jun 17 2012 6:32 AM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Data.OleDb;

namespace Example
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        OleDbConnection con;
        

        private void Form1_Load(object sender, EventArgs e)
        {
            con = new OleDbConnection(@"PROVIDER = Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Reliable\My Documents\exampledb.mdb");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                con.Open();
                MessageBox.Show("Connection Open ! ");
                con.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Can not open connection ! ");
            }
        }
    }
}



hi this is my code i'm getting message as Can not Open Connection what is the reason ........
Anybody help me out........




Answers (1)