什么oraclecommand.bindbyname = true意味着什么? [英] What oraclecommand.bindbyname = true means exactly?

查看:608
本文介绍了什么oraclecommand.bindbyname = true意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我开发了一个vb.NET应用程序并尝试插入和更新数据库表。以下更新查询是否有效?如果我设置BindByName = True,.NET会将null和SYSDATE视为参数吗? PS这是缩短查询,实际查询有点复杂,所以在我试用之前需要一些确认





Hi Iam developing a vb.NET application and trying to insert and update a database table. Will the below update query work? If I set BindByName = True will .NET consider null and SYSDATE as parameters as well? P.S this is shortened query and the actual query is a bit complex and so wanted some confirmation before i try it out


cmd.Parameters.Clear() 
cmd.CommandText = "UPDATE TBL_xxx_xxx SET NEXT=null, ACTIONDATE=SYSDATE, comments=:pcomments, STATUS=11 WHERE ACTIONDATE IS NULL AND WFID=:pwid AND ACTIONBY=:pactionby" 
cmd.CommandType = CommandType.Text 
cmd.BindByName = True

                    cmd.Parameters.Add(New OracleParameter(":pcomments", OracleDbType.Varchar2)).Value = somevalue
                    cmd.Parameters.Add(New OracleParameter(":pwid", OracleDbType.Int64)).Value = somevalue
                    cmd.Parameters.Add(New OracleParameter(":pactionby", OracleDbType.Varchar2)).Value = somevalue

                    cmd.ExecuteQuery()





我有什么试过:



到目前为止没什么......在实现



What I have tried:

Nothing so far..... I wanted some understanding of BindByName before implementing

推荐答案

作为文档( BindByName [ ^ ])状态:

As the documentation (BindByName[^]) states:
引用:



6.2.4.5 BindByName





此属性指定集合中的绑定方法。



声明






6.2.4.5 BindByName



This property specifies the binding method in the collection.

Declaration



// C#
public bool BindByName {get; set;}



物业价值





如果参数受名称约束,则返回 true ;返回 false 如果参数受位置约束。



备注




默认= false。


Property Value



Returns true if the parameters are bound by name; returns false if the parameters are bound by position.

Remarks



Default = false.


这篇关于什么oraclecommand.bindbyname = true意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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