我有一张桌子,床身ID有多个不同的状态,就像这样.
PID | term_id | student_id | bed_id | status | Comment
--------+------------+---------------+-----------+-----------+----------------
1 | 29 | 1234 | 751 | Canceled | Not this one
2 | 29 | 1234 | 751 | Active | This one
3 | 29 | 531 | 752 | Active | This one too
4 | 29 | 823 | 752 | Canceled | Not this one either
5 | 29 | 525 | 753 | Canceled | But this one too
Run Code Online (Sandbox Code Playgroud)
我想要一个查询,根据状态值为每个bed_id获取一行. …
在SQL Server 2005中,我有一个复杂的视图,需要在某些关系上指定其他条件.在创建视图时不知道这些条件.这是一个大大简化的版本.
SELECT fields FROM table1
LEFT JOIN table2 ON ((table1.pid = table2.fid) AND (table2.condition1 = @runtimecondition));
LEFT JOIN table3 ON ....
LEFT JOIN table4 ON ....
LEFT JOIN table5 ON ....
Run Code Online (Sandbox Code Playgroud)
由于第三方约束,动态SQL直接访问表并进行连接对我来说不是一个选项(这是一个集成,他们希望对我的代码具有单一访问点,最好是视图 - 而不是授予访问权限到各种表).可以用视图完成吗?我必须使用存储过程吗?这是一个可以通过表值函数解决的问题吗?
我的解决方案中有一个 Visual Studio 项目,它引用同一解决方案中的类库项目。该项目编译并执行得很好。但是,当我尝试在设计器中打开一个表单时,我收到一条消息:
无法加载文件或程序集“MyLibName,Version=1.0.5477.26907,Culture=neutral,PublicKeyToken=null”或其依赖项之一。该系统找不到指定的文件。
但是,DLL的当前版本是:1.0.5510.41110
为什么设计师要尝试寻找旧版本?如何在设计器中打开我的表单?
我尝试从我的项目中引用它的所有项目中删除该库并重新添加它。当然,我也尝试过从头开始清理和重建项目。任何帮助表示赞赏。
这是堆栈跟踪:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, …Run Code Online (Sandbox Code Playgroud)