怎么在c#里面执行SQL语句使用变量,可以在界面上输入多少,程序显示的就是多少

2024-11-03 00:16:35
推荐回答(1个)
回答1:

这一条语句:string sqlStr = @"SELECT a.name, b.rows
FROM sysobjects AS a INNER JOIN
sysindexes AS b ON a.id = b.id
WHERE (a.type = 'u') AND (b.indid IN (0, 1)) AND rows > av
ORDER BY b.rows DESC";
改为:
string sqlStr = @"SELECT a.name, b.rows
FROM sysobjects AS a INNER JOIN
sysindexes AS b ON a.id = b.id
WHERE (a.type = 'u') AND (b.indid IN (0, 1)) AND rows > " + av +
" ORDER BY b.rows DESC";
这样试一下