How to save listview data to database?
Not work code:
private void Insertbutton_Click(object sender, EventArgs e)
{
string strConnection = "Data Source=OCH-ERDENE\\SQLEXPRESS;Initial Catalog=Database;Integrated Security=True; Pooling=False";
SQLiteConnection conn = new SQLiteConnection(strConnection);
conn.Open();
for (int cnt = 0; cnt <= lsvXML.Items.Count; cnt++)
{
string query = "INSERT INTO DataObject VALUES('" + lsvXML.Items[cnt].Text + "')";
SQLiteCommand cmd = new SQLiteCommand();
cmd.CommandText = query;
cmd.CommandType = CommandType.Text;
cmd.Connection = conn;
cmd.ExecuteNonQuery();
}
conn.Close();
}