首页 新闻 会员 周边

.net向Mysql插入数据

0
悬赏园豆:10 [已关闭问题] 关闭于 2013-11-21 17:11

这为插入函数:

public virtual bool Insert(IUruserRecord uruser)
        {
            SqlRunTimeNote note = uruser.Note;
            if(note != null) note.AppendLine(SqlReturnState.Start, "开始Insert...");
            //组装SQL
            string insertCommandTextTemplate = @"insert into
    {0}(userId, userName, phoneNumber, address, sex)
    Values(:userId, :userName, :phoneNumber, :address, :sex)";//这里为插入语句,原本为Oracle的,现在要改成Mysql用的,":userId, :userName, :phoneNumber, :address, :sex"这些数据绑定不上.
            string insertCommandText = string.Format(insertCommandTextTemplate, SchemaName + "." + Uruser.QueryTableName);
            //装载指令
            DbCommand cmd = Dbo.NewCommand(insertCommandText);
            uruser.LoadChangedParametersAndClear(cmd);
            //执行
            Dbo.ExecuteCommand(cmd, note);
            return (note.State == SqlReturnState.Success);
        }

急需大神

Allenthandy的主页 Allenthandy | 初学一级 | 园豆:136
提问于:2013-11-21 12:02
< >
分享
所有回答(1)
0

http://www.cnblogs.com/humble/p/3380065.html

这个可以解决你的问题

迅捷网络[来送福利] | 园豆:576 (小虾三级) | 2013-11-21 13:31

大神,我们是在自己写代码生成器,在上面的插入语句出现了问题,可否指点一二?

支持(0) 反对(0) Allenthandy | 园豆:136 (初学一级) | 2013-11-21 14:11
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册