首页 新闻 会员 周边 捐助

查询值的数目与目标字段中的数目不同。

0
悬赏园豆:15 [已解决问题] 解决于 2011-01-28 10:06

用access添加一条记录

public static bool AddUser(User user)
  {
       string OleDb = "INSERT INTO [User]([UserName],[UserLoginID],     [UserLoginPassword],[Sex],[Organization],[Address],[Telphone],[Electricaltransmission],[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;
   }
  }

查询值的数目与目标字段中的数目不同。

九妹的主页 九妹 | 初学一级 | 园豆:167
提问于:2011-01-27 21:07
< >
分享
最佳答案
1

string OleDb = "INSERT INTO [User]([UserName],[UserLoginID],     [UserLoginPassword],[Sex],[Organization],[Address],[Telphone],[Electricaltransmission],[Email],[Business],[Photo]) VALUES('UserName','UserLoginID','UserLoginPassword','Sex','Organization','Address','Telphone','Email','Business','Photo')";

少些一个参数吧.

收获园豆:15
changbluesky | 小虾三级 |园豆:854 | 2011-01-28 09:28
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册