如何设置Sql Quires输入为数据网格视图列表行值? [英] How Do I Set Sql Quires Input As Data Grid view List Row Value?
本文介绍了如何设置Sql Quires输入为数据网格视图列表行值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
ex:StrSql =SELECT Name FROM Hospital WHERE PatientsCount ='& DgvList.Rows(DgvList.RowCount - 1).Cells(DgvPDrID)。Valu& 'AND Type ='D'
ex: StrSql = "SELECT Name FROM Hospital WHERE PatientsCount ='" & DgvList.Rows(DgvList.RowCount - 1).Cells("DgvPDrID").Valu & "' AND Type='D' "
推荐答案
在SQL语句中使用值的正确方法是使用SqlParameter [ ^ ]。例如,请查看 http://www.dotnetperls.com/sqlparameter [ ^ ]
The correct way to use values in a SQL statement is to use SqlParameter[^]. For example have a look at http://www.dotnetperls.com/sqlparameter[^]
尝试DgvList.Rows(yourRowIndex)。单元格(yourColumnIndex).Value
。
如上所述,使用 Sql参数 [ ^ ]。
这篇关于如何设置Sql Quires输入为数据网格视图列表行值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文