Home > Net >  Write a vb.net test sqlite code, an error, to overcome the rush!
Write a vb.net test sqlite code, an error, to overcome the rush!

Time:09-21

Dim conn the As System. Data. SQLite. SQLiteConnection

Conn=New SQLiteConnection (Data Source="d: \ northwindEF db. Pooling=true; FailIfMissing=false ")
Conn. The Open ()

Dim sa As New SQLiteDataAdapter (" select * from customers ", conn.)
Dim ds As the New System. The Data. The DataSet
Sa. The Fill (ds)
Dim mytable As the New System. The Data. The DataTable
Mytable=ds. Tables (0)
Me. DataGridView1. The DataSource=mytable
Me. DataGridView1. Refresh ()
Ds. Tables (0). The Rows (0). The Item (1)="88"
Me. DataGridView1. Refresh ()
Sa. Update (ds)

Error

System. InvalidOperationException: "when passing has modified the DataRow collection, effective UpdateCommand update request,"

When I use the oledb access acess database hasn't released this mistake

CodePudding user response:

Ok
Dim builder As SQLiteCommandBuilder=New SQLiteCommandBuilder (sa)

CodePudding user response:

I usually directly define the DataTable, then fill it ok,

The DataTable dt=new DataTable ();
Adapter. The Fill (dt);
DataGridView1. The DataSource=dt;

Of course the SqlDataAdapter and you as the above,
  • Related