无法从Visual Studios中的Azure数据库检索创建的表 [英] Cannot retrieve created table from Azure Database in Visual Studios
问题描述
因此,我遵循了如何对Azure数据库使用Cordova插件".文档,而我想做的很简单.创建与Azure数据库的客户端连接,只需阅读页面中的内容.我遵循了快速入门文档
信中并下载了一个预制的zip文件,其中包含一个已连接到Azure的Cordova应用程序.该项目连接到Azure,并读取名为todoitem的表.所以我接下来要做的就是在其中创建自己的简单表
数据库,所以我创建了一个带有ID和字符串的简单表.问题?当我将tableName var更改为表的名称时,由于某种原因,它什么也做不了!它适用于已经制成的桌子,但不适用于我制成的桌子!这是我的代码
使用...
var tableName ="newTable"
var client = WindowsAzure.MobileServiceClient(appUrl); //忽略appURL var
var table = client.getTable(tableName);
函数成功(结果){
alert(阅读成功");
//我的代码在这里
}
函数失败(错误){
引发新错误('错误加载数据:',错误);
}
桌子
.read()
.then(成功,失败);
我正在简单地做的是检查表是否全部被读取.问题是由于某种原因,即使我只发出警告以查看是否调用了函数success(),也什么也没发生.奇怪的是,如果我将tableName改回"todoitem",
它已经随整个教程一起提供了,它可以完美地工作,但是当我创建自己的表时,我所做的事情就无济于事了,它只是不会读取表,甚至不会调用成功或失败函数....
有人知道我在做什么错吗?
So, I followed the "How to use Cordova Plugin for Azure Database" documentation and what I am trying to do is simple. Create a client connection to Azure Database and simply read the contents in the page. I followed the quickstart document
to the letter and downloaded a pre-made zip file containing an already made cordova app that connects to Azure. The project connects to Azure and it reads a table called todoitem. So the next thing I wanted to do was create my own simple table within that
database, so I created a simple table with an ID and a string. The problem? When I change the tableName var to the name of the table, for some reason, it dosen't do ANYTHING! It works for the already-made table but not the one I made! This is the code I am
using...
var tableName = "newTable"
var client = WindowsAzure.MobileServiceClient(appUrl); //ignore the appURL var
var table = client.getTable(tableName);
function success(results) {
alert("The reading was a success");
// my code here
}
function failure(error) {
throw new Error('Error loading data: ', error);
}
table
.read()
.then(success, failure);
What I am SIMPLY doing is to check if the table is read at all. The problem is that for some reason, even when I put nothing but an alert to see if function success() was called, nothing happens. What is wierd is that if I changed the tableName back to "todoitem",
which already came with the whole tutorial, it works perfect, but when I make my own table, no matte what I do, it just won't read the table or even just call either the sucess or failure functions....
Does anyone know what I am doing wrong?
推荐答案
嗨Ramon,
Hi Ramon,
请提供您要遵循的说明或文档.
Please provide the instructions or documentation that you are following.
MobileServiceClient. GetTable方法
public Microsoft.WindowsAzure.MobileServices.IMobileServiceTable GetTable (string tableName);
这篇关于无法从Visual Studios中的Azure数据库检索创建的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!