在RichTextBox中显示SQL查询的结果 [英] Show result of SQL query in RichTextBox

查看:60
本文介绍了在RichTextBox中显示SQL查询的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Richtextbox中显示我的sql查询结果

I am trying to display the result of my sql query in a richtextbox 

这是我的查询,其中N'aryTextFile(i)是一个变量,我正在尝试与该变量比较表puadhitotaxali的列值.我是Vb.net的新手.请帮助我.

This is my query where N'aryTextFile(i) is a variable with which i am trying to compare column value of my table puadhitotaxali. i am new to Vb.net. please help me..

推荐答案

尝试最简单的方法:

Try the simplest approach:

cmd.CommandText = "Select taxali from puadhitotaxali where puadhi=N'" & aryTextFile(i).Replace("'", "''") & "'"

即使对某些实验有好处,但通常不建议这样做.您应该在软件产品的下一版本中考虑参数化查询".   然后不需要串联和 Replace .例子: https://social.msdn.microsoft.com/Forums/vstudio/zh-CN/6bdf8b71-1cf1-41c0-848c-4fca2c9e1ea2 .

Even though it is good for some experiments, it is usually not recommended. You should consider "Parameterised Queries" in the next version of your software product.  Then concatenations and Replace are not needed. Example: https://social.msdn.microsoft.com/Forums/vstudio/en-US/6bdf8b71-1cf1-41c0-848c-4fca2c9e1ea2.


这篇关于在RichTextBox中显示SQL查询的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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