2021年4月6日星期二

SQL AZUREDATABASE CONFUSING ERROR MESSAGE, SQL SERVER

==i tried inserting a data on azure SQL database with this code

Users user = new Users()                  {                      username = txtUsername.Text,                      userPassword = txtPassword.Text                  };                    await App.client.GetTable<Users>().InsertAsync(user);  

==then when I run the code it shows this error

"InvalidOperationExecution: No id member found on type Model.Users"  

==so I checked my model / c# class

public class Users      {          [JsonProperty(PropertyName = "user_id")]          public int user_id { get; set; }          public string username { get; set; }          public string userPassword { get; set; }      }  

so tried to change the json property from "user_id" to "id" like this

public class Users      {          [JsonProperty(PropertyName = "id")]          public int user_id { get; set; }          public string username { get; set; }          public string userPassword { get; set; }      }  

when I run again the program it shows this error

"InvalidOperationExecution: No id member found on type Model.Users"  

what should I do? i already provided "user_id" at first but it shows error, where did I go wrong? this is my database

Create table Users  (        user_id                  int                     primary key identity(1,1),        username                 varchar(30)             not null,        user                 varchar(30)             not null,  )  
https://stackoverflow.com/questions/66979033/sql-azuredatabase-confusing-error-message-sql-server April 07, 2021 at 11:05AM

没有评论:

发表评论