Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用SQLite net在SQLite中插入和更新_Sqlite_Windows Runtime - Fatal编程技术网

如何使用SQLite net在SQLite中插入和更新

如何使用SQLite net在SQLite中插入和更新,sqlite,windows-runtime,Sqlite,Windows Runtime,我有以下资料: 1) 后端服务器中的SQL Server: tblCustomer ID CompanyName Group Product group GST -- ----------- ------- ------------- ---- 1 The One Exp A 4 2 The One Exp A 8 . .

我有以下资料:

1) 后端服务器中的SQL Server:

tblCustomer ID CompanyName Group Product group GST -- ----------- ------- ------------- ---- 1 The One Exp A 4 2 The One Exp A 8 . . 20 TBL客户 ID公司名称集团产品集团GST -- ----------- ------- ------------- ---- 一个是一个4 2.一个是8 . . 20 2) SQLite DB内置平板电脑设备

tblCustomer ID CompanyName Group Product group GST -- ----------- ------- ------------- ---- 1 The One Exp A 4 2 The One Exp A 8 . The One . 20 The One TBL客户 ID公司名称集团产品集团GST -- ----------- ------- ------------- ---- 一个是一个4 2.一个是8 . 那个 . 20一 (三) 我使用webservice从服务器获取数据,并使用下面的代码使用SQLite Net api将记录插入SQLite Db

The Problems: 1). How to I update the tblCustomer in SQLite for changes below: Note: ID in SQL sever and Sqlite ARE not the same. ID CompanyName Group Product group GST -- ----------- ------- ------------- ---- 1 The One Exp A 6 < -- before it was 4 2) Someone add data in SQL Server and the total record is 21 now. How to add this record in SQLite tbl customer? foreach ( var client in Customers) { InsertNewCustomer(client.Company, client.Group, client.ProductGroup, client.GST) } private void InsertNewCustomer(string Company,string Grp, string PGrp, int Gst) { 1) How to create SQL Statement for this case? var existingCustomer = (db2.Table<Customer>().Where(c => c.No == Company)) ??? if (existingCustomer != null) { ??-- how to handle? int success = db2.Update(existingCustomer); } else { int success = db2.Insert(new Customer() { Name = Company, Group = Grp, ProductGroup = PGrp, GST = Gst }); } } 问题是: 1). 如何在SQLite中更新tblCustomer以进行以下更改: 注意:SQLServer和Sqlite中的ID不相同。 ID公司名称集团产品集团GST -- ----------- ------- ------------- ---- 1在4之前的1 Exp A 6<-- 2) 有人在SQL Server中添加了数据,现在总记录是21。 如何在SQLite tbl customer中添加此记录? foreach(客户中的var客户机) { InsertNewCustomer(client.Company、client.Group、client.ProductGroup、client.GST) } 私有void InsertNewCustomer(字符串公司、字符串Grp、字符串PGrp、整数Gst) { 1) 如何为这种情况创建SQL语句? var existingCustomer=(db2.Table()。其中(c=>c.No==Company))??? if(existingCustomer!=null) { ??如何处理? int success=db2.Update(existingCustomer); } 其他的 { int success=db2.Insert(新客户() { 名称=公司, 组=Grp, ProductGroup=PGrp, 消费税=消费税 }); } } 1) 更新TBL客户集GST=6,其中ID=1

2) 您需要像这样执行SQLite语句: 在TBL客户(公司名称、集团、[产品集团]、GST)中插入值(“新公司”、“EXP”、“A”和“2”)

3) 与1)相同,但 更新tblCustomer SET CompanyName='Newcompany',Group='EXP',[Product Group]='A',GST=6,其中ID=1


当然,您必须替换'Newcompany','EXP',ID=1。。。对于实际数据

SQL server和SQLite中的ID不相同。你能告诉我用SQLITE网的方法吗。