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
Smita
NA
3
0
Unable to update database from datagridview
Aug 11 2010 4:58 PM
Hi ,
I am trying to update database through datagridview, its neither throwing any error nor updating the database.
SQLiteConnection con = new SQLiteConnection(@"data source=C:\SQLiteDB\Test.sqlite");
SQLiteCommand Cmd = new SQLiteCommand() ;
SQLiteDataAdapter ad = new SQLiteDataAdapter();
DataSet ds = new DataSet();
DataRow dr;
DataTable dt = new DataTable();
SQLiteCommandBuilder bd;
SQLiteCommandBuilder cb;
form_load
{
con.Open();
SQLiteCommand Cmd = con.CreateCommand();
Cmd.CommandText = "select * from SqliteSmithaTbl";
SQLiteDataAdapter ad = new SQLiteDataAdapter(Cmd.CommandText, con);
ad.Fill(ds, "test");
//ad.Fill(dt);
cb = new SQLiteCommandBuilder(ad);
BindingSource bSource = new BindingSource();
bSource.DataSource = ds.Tables["test"];
dataGridView1.DataSource = bSource;
}
button click event
{
cb.RefreshSchema();
dataGridView1.EndEdit();
ad.AcceptChangesDuringUpdate = true;
ds.AcceptChanges();
ad.UpdateCommand = cb.GetUpdateCommand();
ad.InsertCommand = cb.GetInsertCommand();
//ad.DeleteCommand = cb.GetDeleteCommand();
ad.Update(ds.Tables["test"]);
ad.Dispose();
con.Close();
}
Please help..........!!
Reply
Answers (
1
)
MouseEventHandler error
Dropdownlist