TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
shuba rani
NA
1
1.8k
Hi, I am very new to C#, I have to create an application that reads data from excel and checks if an...
Jun 24 2012 11:59 AM
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];
Reply
Answers (
2
)
how to copy the data from excel to sqlserver
dataridview question