字段太小而不能接受所要添加的数据的数量。试着插入或粘贴较少的数据

string OleDb = "INSERT INTO [User]([UserName],[UserLoginID],[UserLoginPassword],[Sex],[Organization],[Address],[Telphone],[Email],[Business],[Photo]) VALUES('@UserName','@UserLoginID','@UserLoginPassword','@Sex','@Organization','@Address','@Telphone','@Email','@Business','@Photo')";
   
   try
   {
    OleDbParameter[] para = new OleDbParameter[]
    {
                    new OleDbParameter("@UserName",user.UserName),
                    new OleDbParameter("@UserLoginID",user.UserLoginID),
                    new OleDbParameter("@UserLoginPassword",user.UserLoginPassword),
                    new OleDbParameter("@Sex",user.Sex),
                    new OleDbParameter("@Organization",user.Organization),
     new OleDbParameter("@Address",user.Address),
                    new OleDbParameter("@Telphone",user.Telphone),
                    new OleDbParameter("@Email",user.Email),
                    new OleDbParameter("@Business",user.Business),
     new OleDbParameter("@Photo",user.Photo),
                   
     
    };

    int i=DBHelper.ExecuteCommand(OleDb, para);

                return i == 1 ? true : false;
   }
   catch (Exception e)
   {
    Console.WriteLine(e.Message);
    throw e;
   }

System.Data.OleDb.OleDbException: 查询值的数目与目标字段中的数目不同。

叮当猫咪
浏览 2027回答 3
3回答

慕勒3428872

表面上看少了photo,代码不完整,看不出来啊。
打开App,查看更多内容
随时随地看视频慕课网APP