Я создал лазурную мобильную службу и правильно настроил все таблицы базы данных (протестировал их). Однако, когда я пытаюсь вставить запись в таблицу SQL через приложение для Android, запись не добавляется. (Да, моя таблица SQL также готова для мобильной службы. Также изменил схему)Azure Mobile Service: Невозможно вставить записи в таблицу?
У меня также нет ошибки.
Вот мой код:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_screen);
final String mobileServiceUrl =
"https://MY_AZURE_MOBILE_URL.net/tables/UserTable";
final String mobileServiceAppId =
"MY_MOBILESERVICE_APPID";
try {
// Create the Mobile Service Client instance, using the provided
// Mobile Service URL and key
mClient = new MobileServiceClient(
mobileServiceUrl,
mobileServiceAppId,
this);
// Get the Mobile Service Table instance to use
mToDoTable = mClient.getTable(UserTable.class);
} catch (MalformedURLException e) {
}
Button regiBtn = (Button) findViewById(R.id.signupDivertBtn);
regiBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try
{
UserTable user = new UserTable();
user.setPassword("111");
user.setFname("TESTName");
user.setId("234232");
user.setEmail("[email protected]");
mToDoTable.insert(user);
}
Почему не mToDoTable.Insert() заявление работы? Неправильно ли вставить запись в лазурную таблицу?
EDIT:
Вот мой UserTable Entity Класс:
public class UserTable {
@com.google.gson.annotations.SerializedName("id")
private String id;
@com.google.gson.annotations.SerializedName("Email")
private String email;
@com.google.gson.annotations.SerializedName("Password")
private String password;
@com.google.gson.annotations.SerializedName("UserFName")
private String fname;
public UserTable()
{
}
public UserTable(String id, String email, String password, String fname) {
this.setId(id);
this.setEmail(email);
this.setPassword(password);
this.setFname(fname);
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getFname() {
return fname;
}
public void setFname(String fname) {
this.fname = fname;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
Хм я тоже пробовал этот формат URL-адреса, но все равно не повезло. Правильно ли введен код вставки? – user3306938
Вы изменили разрешения на операцию Insert? – CSharpRocks
Нет, нет. Пожалуйста, объясните, дорогой сэр :) – user3306938