Hi, I am very new to C#, I have to create an application that reads data from excel and checks if an...
Hi,
I am very new to C#, I have to create an application that reads data from excel and checks if any cell in excel is empty.
I have imported the excel contents onto DataGridView.Now i want to check if any cell is empty. Please help in completing this code
Please find the code so far.
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;
namespace Excel
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\V12.xlsx" + @";Extended Properties=""Excel 12.0;HDR=Yes;ImportMixedTypes=Text;TypeGuessRows=0""";
OleDbCommand Command = new OleDbCommand
("SELECT* FROM [Sheet1$]", conn);
DataSet dsIDs = new DataSet();
OleDbDataAdapter adapter = new OleDbDataAdapter(Command);
adapter.Fill(dsIDs);
dataGridView1.DataSource = dsIDs.Tables[0];