c# - SQLite insert does not work in DAL, no errors appear? -


i'm new sqlite database.
i'm trying insert new record in sqlite db table "time_sheet_info", invoke dal method .asmx webservice; & no errors; executenonquery returns 1; no data appears.
i've tried execute insert command inside webservice; worked there!!

any suggestions?

**note: access ws using auto-generated proxy.

gui:

protected void page_load(object sender, eventargs e)     {         if (!ispostback)         {             savedatadolcls data = new savedatadolcls();             data.intprojectid = 1;             data.inttaskid = 1;              webservice1 wsp = new webservice1();             wsp.savedata(data);         }     } 

ws:

 [webmethod]     public void savedata(savedatadolcls arrdata)     {         using (transactionscope scope = new transactionscope())         {             obj1.savedata(arrdata);         }      } 

dal:

savedatadolcls obj = new savedatadolcls();     public void savedata(savedatadolcls arrdata)     {         using (sqliteconnection conn = new sqliteconnection())         {             string dbpath = system.io.path.combine(appdomain.currentdomain.basedirectory, "db\\mysqlitedb.db");             string connstr = "data source= " + dbpath + "; version=3;";             conn.connectionstring = connstr;             conn.open();             using (sqlitecommand cmd = new sqlitecommand(conn))             {                 cmd.commandtype = commandtype.text;                 cmd.commandtext = "insert time_sheet_info (project_id, task_id) values ('1','3');";                 int = cmd.executenonquery();             }             conn.close();         }     } 

you have call scope.complete @ end of using block i.e.:

using (transactionscope scope = new transactionscope()) {     obj1.savedata(arrdata);     scope.complete(); } 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -