如何在没有显示错误的情况下更改视图cardsdatavalue多部分标识符“dbo.cardreceived.year”。无法受约束。 ? [英] How to change view cardsdatavalue without display error the multi-part identifier "dbo.cardreceived.year" could not be bound. ?

查看:91
本文介绍了如何在没有显示错误的情况下更改视图cardsdatavalue多部分标识符“dbo.cardreceived.year”。无法受约束。 ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在app上使用csharp和sql server 2014数据库



当检查我发现的问题时



表名在字段之前如下:



I work on app using csharp and sql server 2014 database

when check the problem problem i found

that tablename exist before fields as following :

SELECT     * from cardsdatavalue Where 1=1  and  dbo.CardReceived.Year = '2019' and  dbo.CardReceived.ReceivedDate >= '2019-01-01' and CardReceived.ReceivedDate <= '2019-04-16'





上面的声明如果我从哪里删除了表名卡,那么这将使我做新的exe以便

/>
如何在视图上进行更改以从SQL Server 2014执行此工作而不用更改c / sharp
更改c / b
意味着我需要更改视图cardsdatavalue不显示多部分错误?





the statement above will work if i removed table name cardrecieved from where statement

but this will make me doing new exe so that
How to do changes on view to do this work from SQL server 2014 without
change on c sharp exe ?
meaning i need to change view cardsdatavalue to make multi part error not display ?

create view cardsdatavalue as <pre>SELECT        dbo.CardReceived.MemberCode, dbo.Members.SpecialCode, dbo.Members.Name, dbo.CardReceived.Year, dbo.CardReceived.ReceivedDate, 
                         dbo.CardReceived.Notes, dbo.CardReceived.CardType, dbo.CardType.CardAraType, dbo.CardType.CardLatType
FROM            dbo.CardReceived LEFT OUTER JOIN
                         dbo.CardType ON dbo.CardReceived.CardType = dbo.CardType.CardTypeId LEFT OUTER JOIN
                         dbo.Members ON dbo.CardReceived.MemberCode = dbo.Members.MemberCode





我尝试了什么:



防止错误通过更改视图viewcardsdata来显示多部分标识符



What I have tried:

prevent error The multi-part identifier from displaying by changing view viewcardsdata

推荐答案

你想改变程序的工作方式而不改变它?显然这是不可能的。如果您希望能够在不更改应用程序的情况下更改SQL,则将SQL放入存储过程并从代码中调用存储过程。这样您就可以更改存储过程而无需更新应用程序。
You want to change how the program works without changing it? Obviously that's impossible. If you want the ability to change the SQL without changing your app then put the SQL in a stored procedure and call the stored procedure from your code. That way you can change the Stored Procedure without having to update your application.


这篇关于如何在没有显示错误的情况下更改视图cardsdatavalue多部分标识符“dbo.cardreceived.year”。无法受约束。 ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆