DataReader最佳实践(DataReader best-practices)
与这个问题类似,但答案从未真正解决我想知道的问题。 有没有关于从DataReader获取值的标准? 也就是这个
dataReader.GetString(dataReader.GetOrdinal("ColumnName"));
认为更好/更糟糕/相同呢?
(string) dataReader["ColumnName"];
Similar to this question, but the answers never really got around to what I want to know. Is there any standards around getting values from a DataReader? I.e., is this
dataReader.GetString(dataReader.GetOrdinal("ColumnName"));
considered better/worse/the same as this?
(string) dataReader["ColumnName"];
原文:https://stackoverflow.com/questions/1855556
更新时间:2021-12-31 07:12
最满意答案
你正在调用shell的历史替换。 用单引号括住感叹号。
You're invoking the shell's history substitution. Surround the exclamation point with single quotes.
相关问答
更多-
unix中shell命令的“未找到事件”错误[复制](“Event not found” error for shell command in unix [duplicate])[2023-08-12]
你正在调用shell的历史替换。 用单引号括住感叹号。 You're invoking the shell's history substitution. Surround the exclamation point with single quotes. -
尝试: echo $0 这通常在一系列炮弹之间工作。 Try: echo $0 This often works across a range of shells.
-
=运算符后不应该有空格,即: num=$(echo $compareFile1 | wc -w) there should not be space after the = operator, that is: num=$(echo $compareFile1 | wc -w)
-
egrep "($1|$2)" Cities.txt > test.txt # change single quote to double quote if [ $# -eq 1 ] && grep -q -- "$1" test.txt ; then grep -- "$1" Cities.txt elif [ $# -eq 2 ] && egrep -q -- "($1|$2)" test.txt ; then egrep -- "($1|$2)" Cities.txt > $2.txt ...
-
shell脚本中特定行结尾的命令未找到错误(Command not found error for particular line endings in shell script)[2024-01-26]
每个sqlplus命令都在反引号中,因此shell将尝试执行命令的输出。 我猜测输出不是有效的shell,这就是它抱怨的原因。 简单的解决方法是删除反引号: "$ORACLE_HOME"/bin/sqlplus -s /nolog <删除整个命令周围的单引号,并在$@周围使用双引号 function compile() { javac -classpath "emarket.jar" "$@".java -Xlint:unchecked; } 请参阅此处的引用变量示例。 remove the single quotes surrounding the whole command, and use double quotes around $@ function compile() { javac -classpath "e ...适当的方法是: 检查它是否是shell中的内置命令。 例如, cd应该可能是内置命令。 fork并尝试exec它。 ( execvp可能实际上就是你真正想要的)。 如果失败,请检查errno以确定原因。 例: #include#include #include #include int main(int argc, char* argv[]) { if (argc != 2) { printf("us ... 有两个问题: 这些行没有返回任何内容,或者至少是一个字符串: HUMIDITY=`$SCRIPT | grep "Temp" | awk -F " " '{print $7}'` TEMPRATURE=`$SCRIPT | grep "Temp" | awk -F " " '{print $3}'` 这导致=: command not found错误。 你的状况需要 while [[ $HUMIDITY == "" && $TEMPRATURE == "" ]] 最后,虽然没有引起问题,但TEMPERA .../usr/local/mysql/bin很可能不在系统的PATH环境变量中 。 您可以通过在~/.bash_profile添加这样的行来将其添加到路径中 export PATH=${PATH}:/usr/local/mysql/bin (您需要重新启动shell才能使上述内容生效。)另一个选择是将MySQL二进制文件符号链接到路径上已有的目录。 像这样的东西: sudo ln -s /usr/local/mysql/bin/mysqld /usr/bin/mysqld 您需要输入root密码才能将符号链 ...错误就是这条线上的'$ ans' $ans=$(expr $n1 $op $n2); 应该 ans=$(expr $n1 $op $n2); '$'正在评估变量'ans',结果不是将结果赋值给变量'ans',而是试图将结果赋值为'0'。 The error is coming the '$ans' on this line $ans=$(expr $n1 $op $n2); Should be ans=$(expr $n1 $op $n2); The '$' is evaluating the ...相关文章
更多- MySQL最佳实践
- There is already an open DataReader associated with this Connection which must be closed first
- Solr Configuration Best Practices and Troubleshooting Tips
- Hibernate的最佳实践
- 微信公众平台开发最佳实践
- Hadoop管理员的十个最佳实践
- 【第七章】 对JDBC的支持 之 7.5 集成Spring JDBC及最佳实践 ——跟我学spring3
- 2010年最佳开源软件
- 转载:2010年最佳开源软件
- Storm【实践】系列- 我们实践业务的背景
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)