希望有人可以提供帮助,我继续使用以下sql语句获取不正确的“WHERE”语法
using (SqlCommand selectT = new SqlCommand("Select [TR_RegNumber]
FROM dbo.TrailerDetail
WHERE [TR_Routes] = '" +trailersRoutesAllocations[i]+ "'" + "
AND WHERE [TR_Classficiation] = '" +trailersVragClassification[i]+ "'", con))
我在C#中编码(使用Visual Studio)
答案 0 :(得分:2)
你还有一个。只写一个像这里的地方:
SELECT column1, column2, ...
FROM table_name
WHERE condition1 AND condition2 AND condition3 ...;
的副本
答案 1 :(得分:0)
删除AND条件中的额外位置,它应该有效。
using (SqlCommand selectT = new SqlCommand("Select [TR_RegNumber]
FROM dbo.TrailerDetail
WHERE [TR_Routes] = '" +trailersRoutesAllocations[i]+ "'" + "
AND [TR_Classficiation] = '" +trailersVragClassification