如何将参数传递给SQL查询?

时间:2013-03-05 12:13:09

标签: c# sql oledb

* 在C#中调用查询: ***

OleDbCommand cmd = new OleDbCommand("SqlR",connection);
cmd.CommandType = CommandType.StoredProcedure;
OleDbParameter parameter = new OleDbParameter("@kalpiNum",s);//the operators
cmd.Parameters.Add(parameter); rdr = cmd.ExecuteReader();

我没有看到操作员 查询:

SELECT BO.MISHPAHA AS MISHPAHA,
       BO.PRATI AS PRATI,
       TM.LongShem AS LongShem,
       TM.SHEM AS SHEM,**
       TM.semel AS semel,
       TM.OT AS OT,
       (select SUM(KOLOT)
        from TOZAOTR
        where MUAMAD=BO.ZEUT AND kalpi =@kalpiNum) AS Total,
       (select sum(kolot)
        FROM TOZAOTR
        WHERE kalpi =@kalpiNum) AS SuMall,
       ROUND((Total/(SuMall+0.00001))*100,2) AS pre
FROM (MUAMADIM AS MU LEFT JOIN BOHARIM AS BO ON MU.ZEUT=BO.ZEUT)
LEFT JOIN TMIFLAGA AS TM ON MU.MIFLAGA=TM.SEMEL;

0 个答案:

没有答案