2017-05-22 226 views
-1

嗨我有一個wcf json格式的代碼,我得到一個錯誤「語法錯誤意外的令牌<在json中」我不知道該怎麼辦請幫助我,在此先感謝.`公共字符串更新(字符串詳細信息) { string connectionString = GetConnectionString();Gettin錯誤語法錯誤意外的令牌<在json

 //Details = Details.Replace(',', '.'); 
     String[] UpdateUserDetails = new String[15]; 
     // insertUserDetails = Details.Split('~'); 
     using (OleDbConnection connection1 = new OleDbConnection()) 
     { 
      connection1.ConnectionString = connectionString; 
      connection1.Open(); 

      OleDbCommand command = connection1.CreateCommand(); 

      //Check user exits 
      OleDbCommand cmdcheck = new OleDbCommand(); 
      cmdcheck.CommandText = "select count(*) from usermaster where Username='" + UpdateUserDetails[0] + "'"; 
      cmdcheck.Connection = connection1; 
      int iReturn = Convert.ToInt16(cmdcheck.ExecuteScalar()); 
      if (iReturn <= 0) 
      { 
       string sqlUpdate = "UPDATE usermaster SET UserID= '100', UserName='" + 
       details.Split('~')[0] + "', Password = '" + details.Split('~')[1] + "', FirstName = '" + details.Split('~')[2] + "',LastName = '" 
        + details.Split('~')[3] + "', Email = '" + details.Split('~')[4].Replace('#', '.') + "', MobileNo = '" + details.Split('~')[5] + "', UserType = '" 
        + details.Split('~')[6] + "', UserGroup = '" + details.Split('~')[7] + "', PlantLocation = '" + details.Split('~')[8] + "', Department = '" 
        + details.Split('~')[9] + "', Designation = '" + details.Split('~')[10] + "',Approved = 'No' "; 

       OleDbCommand cmdUpdate = new OleDbCommand(); 
       cmdUpdate.CommandText = sqlUpdate; 
       cmdUpdate.Connection = connection1; 
       int x = cmdUpdate.ExecuteNonQuery(); 
       cmdUpdate.Dispose(); 
       if (x == 1) 
        return "User Updated Successfully"; 
       else 
        return "User Updation failed"; 
      } 
      else 
      { 
       return "User Name already exists"; 
      } 
     } 
    }` 
+0

共享代碼,JSON的東西更好地理解這個問題。 –

+0

該錯誤通常表示端點正在從請求中返回HTML或XML,而不是您期望的JSON。檢查responseText,因爲它很可能是由服務器上的錯誤引起的 –

+0

我已經共享了json和wcf代碼@MilanChheda – Harsha

回答

-2

那麼,你可以嘗試植酮3,而不是:

例:

#!/usr/bin/python3 
    import sys 

    if len(sys.argv) > 1: 
    name = sys.argv[1] 
    print("Hello", name) 
相關問題