The Microsoft Jet database engine could not find the object 'test'. Make sure the object exists and that you spell its name and the path name correctly.
- if (txtFileName.Text != "")
- {
-
- string path = txtFileName.Text;
- string id = "";
- string pimage = "";
- string cate = "";
- string subcat = "";
- string pcode = "";
- string peng = "";
- string ptam = "";
- string barcode = "";
- string unit = "";
- string promrp = "";
- string procast = "";
- string pprice = "";
- string aqty = "";
- string alertqty = "";
- string pdetail = "";
- string tax = "";
- string mdate = "";
- string edate = "";
-
- OleDbConnection my_con = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;" +
- "Data Source=" + Application.StartupPath + "\\test.xls;" +
- "Extended Properties=Excel 8.0");
-
- my_con.Open();
-
- OleDbCommand icmd = new OleDbCommand("select * from [test] ", my_con);
- //this line eroor Throw
- OleDbDataReader dr = icmd.ExecuteReader();
- while (dr.Read())
- {
- id = dr[0].ToString();
- pimage = dr[1].ToString();
- cate = dr[2].ToString();
- subcat = dr[3].ToString();
- pcode = dr[4].ToString();
- peng = dr[5].ToString();
- ptam = dr[6].ToString();
- barcode = dr[7].ToString();
- unit = dr[8].ToString();
- promrp = dr[9].ToString();
- procast = dr[10].ToString();
- pprice = dr[11].ToString();
- aqty = dr[12].ToString();
- alertqty = dr[13].ToString();
- pdetail = dr[14].ToString();
- tax = dr[15].ToString();
- mdate = dr[16].ToString();
- edate = dr[17].ToString();
-
- MySqlConnection con = new MySqlConnection("SERVER=localhost;" +
- "DATABASE=shop_management;" +
- "UID=root;" +
- "PASSWORD=;");
- con.Open();
-
- MySqlCommand icmmd = new MySqlCommand("INSERT INTO add_product(id,product_image,category,sub_category,product_code,product_english, product_tamil, barcode,unit,product_mrp,product_cost,product_price,available_quantity,alert_quantity,product_detail,tax,man_date,exp_date)VALUES(@a,@b,@c,@d,@e,@f,@g,@h,@i,@j,@k,@l,@m,@n,@o,@p,@q,@r)", con);
- icmmd.Parameters.AddWithValue("a", id);
- icmmd.Parameters.AddWithValue("b", pimage);
- icmmd.Parameters.AddWithValue("c", cate);
- icmmd.Parameters.AddWithValue("d", subcat);
- icmmd.Parameters.AddWithValue("e", pcode);
- icmmd.Parameters.AddWithValue("f", peng);
- icmmd.Parameters.AddWithValue("g", ptam);
- icmmd.Parameters.AddWithValue("h", barcode);
- icmmd.Parameters.AddWithValue("i", unit);
- icmmd.Parameters.AddWithValue("j", promrp);
- icmmd.Parameters.AddWithValue("k", procast);
- icmmd.Parameters.AddWithValue("l", pprice);
- icmmd.Parameters.AddWithValue("m", aqty);
- icmmd.Parameters.AddWithValue("n", alertqty);
- icmmd.Parameters.AddWithValue("o", pdetail);
- icmmd.Parameters.AddWithValue("p", tax);
- icmmd.Parameters.AddWithValue("q", mdate);
- icmmd.Parameters.AddWithValue("r", edate);
- icmmd.ExecuteNonQuery();
- con.Close();
- }
-
- MessageBox.Show("data Imported");
- txtFileName.Text = "";
-
-
- }