2017-05-22 247 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) 
相关问题