以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关于SQLCommand  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=186005)

--  作者:ygg8310
--  发布时间:2023/3/31 9:11:00
--  关于SQLCommand
问题1,SQLCommand如何提取某一行的主键号?,例如产品=pd01 ,单号=100的主键号
问题2,SQLCommand如何计算符合条件的行数?例如产品=pd02的销售量

--  作者:有点蓝
--  发布时间:2023/3/31 9:18:00
--  
1、要获取主键列的名称?还是主键的值?
2、select count(*) from {表A} where 产品=\'pd02\'

--  作者:ygg8310
--  发布时间:2023/3/31 9:21:00
--  
主键的值
--  作者:有点蓝
--  发布时间:2023/3/31 9:24:00
--  
http://www.foxtable.com/webhelp/topics/1567.htm

Dim cmd As New SQLCommand
cmd.ConnectionName = "数据源名称"
Dim
 dt As DataTable
Dim
 cmb As WinForm.ComboBox
cmd.CommandText = "
select * from {表A} where xxx条件"
dt = cmd.ExecuteReader()
for each dr as datarow in dt.datarows
msgboc(dr("_identify"))
next