在绑定网格上,当代码中没有错误时会发生此错误。
private void BindAccountCodeGrid()
{
List<nSYS.Catch6.Client.Model.AccountCodes> oAccountCodesList = new List<nSYS.Catch6.Client.Model.AccountCodes>();
try
{
bool hasAcntCode = nSYSCatch6ServiceInitiator.GetAccountCode(out oAccountCodesList);
if (hasAcntCode)
{
if (oAccountCodesList != null && oAccountCodesList.Count > 0)
{
ViewState["Account"] = oAccountCodesList;
grdAccounts.DataSource = oAccountCodesList;
grdAccounts.DataBind();
}
}
}
catch (Exception ex)
{
throw ex;
}
}
这是我的存储过程
USE [CatchLive]
GO
/****** Object: StoredProcedure [dbo].[p_AccountCodes_Get] Script Date: 04/01/2013 09:47:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[p_AccountCodes_Get]
(
@AccountId int
)
AS
BEGIN
IF @AccountId=0
BEGIN
SET NOCOUNT ON;
SELECT * FROM AccountCodes(NOLOCK)
END
ELSE
BEGIN
SET NOCOUNT ON
SELECT * FROM AccountCodes(NOLOCK)
WHERE AccountId=@AccountId
END
END
答案 0 :(得分:0)
gridview rendering
中有错误。由于您尚未发布gridview
html
我可以猜到的是,您可能会在date
或int
或其他类型中投射某些值。
因此,请检查convert
或Pare
标记
如果您可以发布网格,则更容易回答您的问题。