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
george alabi
NA
7
2.4k
updating datagrid in c' using oledb
Mar 13 2013 3:24 PM
Hi all
im trying to update a datagrid table and below is the code i have been using but every time i run it i get an error:
Error:
System.NullReferenceException was unhandled
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=WindowsFormsApplication6
private void button6_Click(object sender, EventArgs e)
{
string sql = "Insert into [Sheet1$](first,last) Values(`" + textBox1.Text + "`, `" + textBox2.Text + "`)";
connect.Open();
OleDbDataAdapter adap = new OleDbDataAdapter(sql, connect);
adap.SelectCommand.ExecuteNonQuery();
adap.Dispose();
connect.Close();
connect.Dispose();
MessageBox.Show("Saved");
}
Reply
Answers (
6
)
To Refer Control From Previous Page in WindowsFormApplicatio
C# to only run a block of code once