AzureMobile未插入数据

时间:2016-09-10 21:17:41

标签: azure azure-sql-database azure-mobile-services

我使用SQL Server后端创建了一个Azure移动应用程序。这是我的代码

    var userTable = request.azureMobile.tables('User');
    var item = {
        Username: postValues.Username,
        Password: postValues.Password,
        Email: postValues.Email,
        eth_account: web3.personal.newAccount(''),
        CreatedBy: CREATEDBY,
        usertypeid: DEFAULT_USER_TYPE,
        store_name: postValues.storename,
        address1: postValues.address,
        city: postValues.city,
        state: postValues.state,
        zipcode: postValues.zipcode || "",
        phone1: postValues.phone || ""
        // UpdatedBy: UPDATEDBY
        //PrivacyReceive: 'Just Friends',
        //PrivacyShare: 'Just Friends'
    };
    accounts.insert(item).then(function() {
         var userId = aud + ":" + item.id;

         //update our record with the user id
         item.UserId = userId;
         item.Token = jwthelper.zumoJwt(aud, userId, request.service.config.masterKey);
         accounts.update(item);

         // We don't want the salt or the password going back to the client
         delete item.Password;
         delete item.Salt;

         item.Status = "SUCCESS";
         item.Details = "User registered";
         response.status(201).send(item);
         });

测试时我无法插入数据。我检查了控制台日志,这就是我所拥有的:

- silly: Executing SQL statement INSERT INTO [dbo].[User] ([Username],[Password],[Email],[eth_account],[CreatedBy],[usertypeid],[store_name],[address1],[city],[state],[zipcode],[phone1],[Salt],[Token],[id]) VALUES (@Username,@Password,@Email,@eth_account,@CreatedBy,@usertypeid,@store_name,@address1,@city,@state,@zipcode,@phone1,@Salt,@Token,@id); SELECT * FROM [dbo].[User] WHERE [id] = @id with parameters [{"name":"Username","value":"guoyangrui","type":{}},{"name":"Password","value":"kFZ/gcELIr7w7o4f/x8Z12lTfLxhlqyI4+9LpiynjBw=","type":{}},{"name":"Email","value":"guoyangrui@gmail.com","type":{}},{"name":"eth_account","value":"0x6957b6b2cf9aff94106a5a5ad49cdc6fb43f4521","type":{}},{"name":"CreatedBy","value":"Script","type":{}},{"name":"usertypeid","value":3},{"name":"store_name","value":"test store","type":{}},{"name":"address1","value":"test address","type":{}},{"name":"city","value":"test city","type":{}},{"name":"state","value":"test state","type":{}},{"name":"zipcode","value":"00000","type":{}},{"name":"phone1","value":"1234567890","type":{}},{"name":"Salt","value":"nj+WAmzA2EuheHeFvvx+34kgmpTUks54miqtwC8h5jY=","type":{}},{"name":"Token","value":"temp","type":{}},{"name":"id","value":"f5951ba5-f1e9-476b-b7b5-29fe8c3b5b6f","type":{"length":255}}]

没有错误消息。但是,当我通过Easy table检查时,数据不存在。我的代码出了什么问题?

0 个答案:

没有答案