2
        db.transaction(
           function (transaction) {
               transaction.executeSql('INSERT INTO EmployeeTable(Firstname,Lastname,BirthDate,EmployeeType,MaritalStatus,Company,IsActive,Dependents) values(?,?,?,?,?,?,?,?)',
                   [Firstname.toString(), Lastname.toString(), BirthDate, parseInt(empType), parseInt(marital),Company.toString(),active, parseInt(Dependents)]);

               transaction.executeSql('SELECT * FROM EmployeeTable', [], function (transaction, results) {

                   result = results;

                   alert(result.length);

                    for (i = 0; i < results.length; i++) {

                        var EmployeeID = results.rows.item(i).EmployeeID;
                        var Firstname = results.rows.item(i).Firstname;
                        var Lastname = results.rows.item(i).Lastname;

                        alert(results.rows.item(i).EmployeeID + "  " + results.rows.item(i).Firstname + "  " + results.rows.item(i).Lastname);
                        //var product =  [productid, productname, price, qty];                     
                        //insertTableRow(product,i);
                    }




                  }, null);    
           }
         );

ローカル データベースとして WEB SQL を使用しています

db.Transaction() メソッドを使用して websql から取得したデータをサーバー コントローラーに送信します。

同じことを手伝ってください.....

mvcのコントローラーにデータを転送するにはどうすればよいですか.....

    [HttpPost]
    public ActionResult Create(FormCollection collection)
    {
        try
        {

            if (Save(0, collection))
            {
                // List<char> bulkdata = collection["bulkdata"].ToList();
                return RedirectToAction("Index");
            }

            else
            {
                return View("Edit");
            }
        }
        catch
        {
            return View();
        }
    }
4

2 に答える 2

0

localstorage 文字列をシリアライズしてから、サーバーに送信してみてください...

ASP.NET MVC JSON オブジェクトをビューからコントローラーにパラメーターとして渡す方法

于 2014-01-27T17:52:38.060 に答える
0

The following tutorial shows an example how to sync local db with a WCF Data Service endpoint. By combining this with the WebAPI tutorial you will be able to sync to the online DB with these lines:

function synchronizeData() {
        offlinedb
            .TodoItems
            .filter("it.InSync === false")
            .toArray(function (todoItems) {
                onlinedb.addMany(todoItems);
                onlinedb.saveChanges(function () {
                    todoItems.forEach(function (todoItem) {
                        offlinedb.attach(todoItem);
                        todoItem.InSync = true;
                    });
                    offlinedb.saveChanges(function () {
                        listLocalTodoItems();
                        listRemoteTodoItems();
                    });
                });
            })
    }
于 2013-03-01T15:19:28.637 に答える