sqlResult = this.Database.ExecuteSqlCommand(sqlCommand,new SqlParameter(" @InSTALLATION&qu​​ot;,installationId),new SqlParameter(" @ OBJNAM",objName)); if(sqlResult< = 0){sqlResult = 0; [英] sqlResult = this.Database.ExecuteSqlCommand(sqlCommand, new SqlParameter("@INSTALLATION", installationId), new SqlParameter("@OBJNAM", objName)); if (sqlResult <= 0) { sqlResult = 0;

查看:64
本文介绍了sqlResult = this.Database.ExecuteSqlCommand(sqlCommand,new SqlParameter(" @InSTALLATION&qu​​ot;,installationId),new SqlParameter(" @ OBJNAM",objName)); if(sqlResult< = 0){sqlResult = 0;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

executionqlcommand方法返回值

executesqlcommand methods returns values

有人有一个图表,表明返回值对于执行的命令的含义是什么 方法?

Do someone have a chart of what the return values mean for the executesqlcommand  method?

-1是什么意思?

0是什么意思?

这是我在c夏普代码中所做的逻辑。我需要在返回值时更新或插入记录库。

This is the logic I am doing in the c Sharp code. I need to update or insert record base upon return value.

   sqlResult = this.Database.ExecuteSqlCommand(sqlCommand, new SqlParameter("@INSTALLATION", installationId), new SqlParameter("@OBJNAM", objName));


                if (sqlResult <= 0)
                {

//Insert record into database
                }
                else
                {
             //Update record into database
                }

pianoboyCoder

pianoboyCoder

推荐答案

如果要插入数据,1表示添加了一行,超过1表示添加了多行。同样适用于更新命令。

Well if you are inserting data, 1 means one row added, more than 1 means more than one rows added. Same goes for an update command.

对于0,没有添加或更新行。

For 0, no rows added or updated.

对于-1通常这是有某种问题涉及执行的内容,例如INSERT,UPDATE等。

For -1 usually this is there was some sort of problem involved with what was executed e.g. INSERT, UPDATE etc.


这篇关于sqlResult = this.Database.ExecuteSqlCommand(sqlCommand,new SqlParameter(&quot; @InSTALLATION&qu​​ot;,installationId),new SqlParameter(&quot; @ OBJNAM&quot;,objName)); if(sqlResult&lt; = 0){sqlResult = 0;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆