简体   繁体   English

我没有从mysql查询中获得所需的结果

[英]i am not getting the desired result from mysql query

if i insert manualy in the table in database it shows the result in the grid but if i am entering from web page. 如果我在数据库表中手动插入,则会在网格中显示结果,但是如果我是从网页输入的。 it inserts in the database but not shoing in the result (grid in my page). 它插入数据库中,但不增加结果(我页面中的网格)。

my query is 我的查询是

Declare paramfkVoucherType int(11);

SELECT ID INTO paramfkVoucherType 
FROM ListOfValues_AccountVoucherType
WHERE Name='Receipt Voucher';

SELECT 
        V.ID as VoucherID,
        V.Code as VoucherNumber,
        V.ToFrom As `From`,
        V.Amount as Amount,
        V.IsPosted as IsPosted,
        V.PostedDate as PostedDate,
        V.IsApproved as IsApproved,
        V.ApprovalDate as ApprovalDate,
        V.VoucherDate as VoucherDate,
        V.IsEdited as IsEdit,
        V.EditedDate as EditedDate,
        VT.Name as VoucherType,
        V.Description as Description,
        U.UserName As CreatedBy
FROM Account_Voucher V
INNER JOIN ListOfValues_AccountVoucherType VT ON V.fkVoucherTypeID = VT.ID
INNER JOIN usermanagement_user U ON U.ID =v.fkUserID
WHERE (V.fkVoucherTypeID = paramfkVoucherType)
      AND (V.Code like concat('%',spVoucherNumber,'%') OR spVoucherNumber='')
      AND (Date(V.VoucherDate) BETWEEN DATE(spFromDate) AND DATE(spToDate)
           OR DATE(spFromDate)='1/1/0001'
           OR DATE(spToDate)='1/1/0001')
      AND (U.ID =spfkEmployeeID OR  spfkEmployeeID=0)
      AND (V.IsDeleted=0)
      AND (VT.IsDeleted=0);

i want to show it on grid. 我想在网格上显示它。 it is a search query for voucher. 它是对凭证的搜索查询。

please help.. 请帮忙..

thanks in advance. 提前致谢。

You should have a button that will refresh all your elements on your grid. 您应该有一个按钮,它将刷新网格上的所有元素。 Or a button that will update your elements on the grid once you add something on your page and once updated it should automatically refresh the grid so that your elements will be showed. 或者,一个按钮会在您在页面上添加某些内容并且更新后将更新网格上的元素,它应该会自动刷新网格,以便显示您的元素。 Doing the adding of elements on the database manually is not a good practice. 手动在数据库上添加元素不是一个好习惯。

Run this query directly in mysql and see if inserted records are being fetched or not. 直接在mysql中运行此查询,并查看是否正在获取插入的记录。 If not, then inspect your inserted data, especially the fields used in query. 如果不是,则检查您插入的数据,尤其是查询中使用的字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM