如何在VB.NET中获取带参数值(数据源查询)的查询命令文本 [英] How to get query command text with parameter values (data souce query) in VB.NET

查看:79
本文介绍了如何在VB.NET中获取带参数值(数据源查询)的查询命令文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我创建了一个数据集表适配器并成功运行了fillby查询。但是,我的问题是,在运行查询时,如何将包含参数输入的查询作为字符串来检查查询结构以进行调试?



我有什么尝试过:



我试过这样的。但只显示我的查询文本,而不是周长值。

Hi friends, I created one data set table adapter and running with fillby queries successfully. But, My question is, while running a query, How to get my query including parameter inputs as string to check query structure for debugging?

What I have tried:

I tried like this. But showing only my query text, not with perimeters values.

Me.MyAC_Details_tblTableAdapter.Adapter.SelectCommand.CommandText.ToString

推荐答案

你不能获取命令作为包含参数值的字符串:这是使用参数的全部要点,它们不会随时成为字符串的一部分。



你可以总是检查 SelectCommand.Parameters 集合,它可以让你以原生格式而不是字符串访问参数值。
You can't "get the command" as a string including parameter values: that's the whole point of using parameters, they don't become part of the string at any time.

You can always check the SelectCommand.Parameters collection, which should give you access to the parameter values in "native" format rather than as strings.


这篇关于如何在VB.NET中获取带参数值(数据源查询)的查询命令文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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