sql - Cannot insert multiple lines in Sqlite using C# -
i know simple question cannot find answer can me. i'm using c# in order connect sqlite database , insert data. here code :
private void opendb() { this.m_handle = new sqliteconnection("data source=" + m_filename + ".sqlite3;version=3;"); this.m_handle.open(); } private void closedb() { this.m_handle.close(); } private void createdb() { this.opendb(); string query = "create table streamingurl ([url] varchar(255) not null, [daterequest] text not null);"; sqlitecommand command = new sqlitecommand(query, this.m_handle); command.executenonquery(); this.closedb(); } public void addstreamingurl(string url) { this.opendb(); string query = "insert streamingurl (url, daterequest) values ('" + url + "', datetime('now', 'localtime'));"; sqlitecommand command = new sqlitecommand(query, this.m_handle); command.executenonquery(); this.closedb(); }
i can create database table. when try insert 1 data, works good. however, when try add second row not work, sqlite update on (daterequest
updated, think row updated). database file not added project reference or things that.
when use sqliteadministrator insert query, works. think code wrong cannot figure out. don't have exception or errors.
edit : may important have 2 projects in vs solution : 1 dll , 1 exe. code in dll , run exe project> don't know if changes something.
edit2 : added code calls createdb
. in class constructor:
this.m_filename = filename; if (system.io.file.exists(this.m_filename) == false) { sqliteconnection.createfile(this.m_filename + ".sqlite3"); this.createdb(); }
addstreamingurl
called event cannot show entire code. here part think it's interesting :
this.networkmanager.streamingurl += passerelle_streamingurl;
and after event raised :
void passerelle_streamingurl(object sender, eventargs e) { log.addstreamingurl((e streamingurl).url); console.writeline("done"); }
Comments
Post a Comment