将列值放在字符串中 [英] put a column value in string
本文介绍了将列值放在字符串中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将来自查询的sql server数据库中的列值放入字符串中(注意,此查询答案仅是一列),我想将此答案放入字符串中以将其与值进行比较
我该怎么办?
i want to put a column value from sql server database that it was get from a query into a string(notice that this query answer is only one column) and i want to put this answer in a string to compare it with a value
what i must do?
推荐答案
您可以使用ExecuteScalar方法:
you can use ExecuteScalar method as:
string value = (string)command.ExecuteScalar();
检查下面的链接以获取更多信息
http://stackoverflow.com/questions/4960900/how- do-get-a-simple-string-from-a-database [
check below link for more information
http://stackoverflow.com/questions/4960900/how-do-get-a-simple-string-from-a-database[^]
这篇关于将列值放在字符串中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文