Click here to Skip to main content
14,970,403 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i am using ms.net4.0, windows7, ms access2007 database.
I was created database name as "mydata" and table name as "information" in ms access
I was creating windows forms application with chart control to represent "information" table data as graphical manner. But get following exception:
***"The Micro Soft.jet.oledb 4.0" provider is not registered on the local machine.**
I had already set Target CPU--AnyCPU, x86 and i was installed "Access DataBase Engine.exe file".
But i still get the same error please send more information to resolve it.

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.Data.OleDb;
using System.Windows.Forms.DataVisualization.Charting;

namespace chartform
{
public partial class Form1 : Form
{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0:Data Source=C:\\Users\\baswaraj\\Documents\\mydata.accdb; Persist Security Info=False;");
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
if(textBox1.Text=="")
{
MessageBox.Show("enter date and time");
textBox1.Focus();
return;
}
tabControl1.SelectedIndex = tabControl1.SelectedIndex + 1;
string query = "insert into information values('" + textBox1.Text + "'," + textBox2.Text + "," + textBox3 + ")";
OleDbCommand cmd = new OleDbCommand(query, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}

private void chart1_Click(object sender, EventArgs e)
{
string query1 = "select convert(char(8), dateandtime, 10) as dateinfo, sum(nofcigarette) as ciginfo from sheet group by convert(char(8), dateandtime, 10)";
OleDbDataAdapter da = new OleDbDataAdapter(query1, con);
DataSet ds = new DataSet();
da.Fill(ds);
chart1.DataSource = ds;
chart1.DataBind();
chart1.Series["Series1"].ChartType = SeriesChartType.Column;
chart1.Series["Series1"].XValueMember = "date info";
chart1.Series["Series1"].YValueMembers = "nofc info";
chart1.ChartAreas["ChartArea1"].AxisX.Title = "Date";
chart1.ChartAreas["ChartArea1"].AxisY.Title = "No-of-Counts";
}
}
}
Posted

1 solution

Look at the following: http://forums.asp.net/t/1008321.aspx[^]
   
Comments
VJ Reddy 18-Apr-12 19:48pm
   
Good reference. 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900