I just want to get the lines with tax ID "78898989898" and I want the numbers to be transferred in "0.00" format
- string patchmdb;
- OleDbConnection cnEMP = new OleDbConnection();
-
- private void button1_Click(object sender, EventArgs e)
- {
-
- string patchxls = Application.StartupPath + "\\taxlist.xls";
-
- DataTable dtEMP = new DataTable();
- string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + patchxls + "; Extended Properties='Excel 8.0;HDR=No;'";
- using (OleDbConnection cnEMP = new OleDbConnection(ConnectionString.ToString()))
- {
- cnEMP.Open();
- using (OleDbCommand cmdEMP = new OleDbCommand("SELECT * FROM [tax$C5:M]", cnEMP))
- {
- using (OleDbDataReader drEMP = cmdEMP.ExecuteReader())
- {
- dtEMP.Load(drEMP);
- dataGridView1.DataSource = dtEMP;
- }
- }
- cnEMP.Close();
- }
-
- foreach (DataGridViewRow EMPRow in dataGridView1.Rows)
- {
- patchmdb = Application.StartupPath + "\\data.mdb";
-
- cnEMP.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + patchmdb;
- cnEMP.Open();
- OleDbCommand cmdEMP = new OleDbCommand();
- cmdEMP.Connection = cnEMP;
-
-
- string qryEMP = "INSERT INTO bill([a], [b], [c], [d], [e], [f], [g], [h], [j], [k]) ";
- qryEMP = qryEMP + "Values('" + EMPRow.Cells[0].Value + "','" + EMPRow.Cells[2].Value + "','" + EMPRow.Cells[7].Value + "','" + EMPRow.Cells[8].Value + "','" + null + "','" + null + "','" + null + "','" + null + "','" + null + "','" + null + "')";
- cmdEMP.CommandText = qryEMP;
- cmdEMP.CommandType = CommandType.Text;
- cmdEMP.ExecuteNonQuery();
- cnEMP.Close();
- }
-
- OleDbConnection connection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + patchmdb);
- connection.Open();
-
- OleDbCommand kdvsil = new OleDbCommand("DELETE FROM bill WHERE Len(Trim(a &''))=0;", connection);
- kdvsil.ExecuteNonQuery();
- connection.Close();
- }
https://1drv.ms/u/s!Al0E9WhLjd-q9CuIQE7TjKHA1_HZ