Foxtable(狐表)用户栏目专家坐堂 → SQL数据库里的视图如何直接引用?


  共有14360人关注过本帖树形打印复制链接

主题:SQL数据库里的视图如何直接引用?

帅哥哟,离线,有人找我吗?
菜鸟foxtable
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 菜鸟中的老鸟
等级:七尾狐 帖子:1486 积分:10064 威望:0 精华:9 注册:2008/11/14 8:54:00
SQL数据库里的视图如何直接引用?  发帖心情 Post By:2009/12/4 12:39:00 [只看该作者]


图片点击可在新窗口打开查看此主题相关图片如下:qq截图未命名.png
图片点击可在新窗口打开查看



SELECT a.工作单位, a.姓名, a.在职状态, '住院' AS 报销类别, c.诊断 AS 病种,
      a.实际住院天数, b.医疗费总计,
          (SELECT isnull(SUM(合计), 0)
         FROM av_医保住院费用分摊表
         WHERE 住院序号 = a.序号 AND 项目类别 = '药品') AS 药品费,
          (SELECT isnull(SUM(合计), 0)
         FROM av_医保住院费用分摊表
         WHERE 住院序号 = a.序号 AND 项目类别 = '检验检查') AS 检验检查,
          (SELECT isnull(SUM(合计), 0)
         FROM av_医保住院费用分摊表
         WHERE 住院序号 = a.序号 AND 项目类别 IN ('治疗', '手术麻醉', '材料'))
      AS 诊疗及其他,
          (SELECT isnull(SUM(合计), 0)
         FROM av_医保住院费用分摊表
         WHERE 住院序号 = a.序号 AND 项目类别 = '服务设施') AS 服务设施,
          (SELECT SUM(isnull(部分自负, 0) + isnull(全额自负, 0))
         FROM av_医保住院费用分摊表
         WHERE 住院序号 = a.序号) AS 剔除合计,
          (SELECT SUM(isnull(部分自负, 0) + isnull(全额自负, 0))
         FROM av_医保住院费用分摊表
         WHERE 住院序号 = a.序号 AND 项目类别 = '药品') AS 药品剔除合计,
          (SELECT SUM(isnull(部分自负, 0) + isnull(全额自负, 0))
         FROM av_医保住院费用分摊表
         WHERE 住院序号 = a.序号 AND 项目类别 <> '药品') AS 其他剔除合计,
      b.医院收病人金额 AS 个人负担合计, b.统筹基数,
      b.第一档统筹支付额 + b.第二档统筹支付额 + b.第三档统筹支付额 AS 统筹支付金额,
      b.第四档统筹支付额 AS 大额救助金, b.结算日期
FROM dbo.住院病人 a INNER JOIN
      dbo.[av_医保分档统筹支付表] b ON a.序号 = b.住院序号 LEFT OUTER JOIN
      dbo.出院诊断 c ON a.序号 = c.住院序号 AND c.类别 = '主要诊断'
[此贴子已经被作者于2009-12-4 12:47:46编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2009/12/4 12:44:00 [只看该作者]

Select * From {视图名称}

 回到顶部
帅哥哟,离线,有人找我吗?
菜鸟foxtable
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 菜鸟中的老鸟
等级:七尾狐 帖子:1486 积分:10064 威望:0 精华:9 注册:2008/11/14 8:54:00
  发帖心情 Post By:2009/12/4 12:51:00 [只看该作者]


此主题相关图片如下:qq截图未命名.png
按此在新窗口浏览图片
出现错误呀。。。

ee the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at TablePro.WinForm.Form.OOlOl0OOO01O(ControlCollection Oll1Ol0O, DataRow O11O00O0l, Int32 Ol10)
   at TablePro.WinForm.Form.OO1Oll()
   at TablePro.WinForm.Form.Open()
   at TablePro.WinForm.Form.Show()
   at TablePro.FormsManager.O11O1l000l1101(Object O10l1O, EventArgs O)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Foxtable
    Assembly Version: 2009.11.16.1
    Win32 Version: 2009.11.16.1
    CodeBase: file:///D:/Release试用版/foxtable.exe
----------------------------------------
Foxtable.Lib
    Assembly Version: 2009.11.16.1
    Win32 Version: 2009.11.16.1
    CodeBase: file:///D:/Release试用版/Foxtable.Lib.DLL
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System.Data
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
C1.Win.C1Ribbon.2
    Assembly Version: 2.0.20092.178
    Win32 Version: 2.0.20092.178
    CodeBase: file:///D:/Release试用版/C1.Win.C1Ribbon.2.DLL
----------------------------------------
C1.Win.C1Command.2
    Assembly Version: 2.0.20092.19433
    Win32 Version: 2.0.20092.19433
    CodeBase: file:///D:/Release试用版/C1.Win.C1Command.2.DLL
----------------------------------------
System.Management
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Management/2.0.0.0__b03f5f7f11d50a3a/System.Management.dll
----------------------------------------
Accessibility
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Design
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Design/2.0.0.0__b03f5f7f11d50a3a/System.Design.dll
----------------------------------------
C1.Win.C1FlexGrid.2
    Assembly Version: 2.6.20092.416
    Win32 Version: 2.6.20092.416
    CodeBase: file:///D:/Release试用版/C1.Win.C1FlexGrid.2.DLL
----------------------------------------
System.Transactions
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
Foxtable.Blank
    Assembly Version: 0.0.0.0
    Win32 Version: 0.0.0.0
    CodeBase: file:///D:/Release试用版/Catch/Foxtable.Blank.dll
----------------------------------------
Interop.ADOX
    Assembly Version: 2.8.0.0
    Win32 Version: 2.8.0.0
    CodeBase: file:///D:/Release试用版/Interop.ADOX.DLL
----------------------------------------
Interop.ADODB
    Assembly Version: 2.8.0.0
    Win32 Version: 2.8.0.0
    CodeBase: file:///D:/Release试用版/Interop.ADODB.DLL
----------------------------------------
CustomMarshalers
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/CustomMarshalers/2.0.0.0__b03f5f7f11d50a3a/CustomMarshalers.dll
----------------------------------------
Interop.MSScriptControl
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///D:/Release试用版/Interop.MSScriptControl.DLL
----------------------------------------
C1.Win.C1Input.2
    Assembly Version: 2.0.20092.33234
    Win32 Version: 2.0.20092.33234
    CodeBase: file:///D:/Release试用版/C1.Win.C1Input.2.DLL
----------------------------------------
Foxtable.Ribbon
    Assembly Version: 0.0.0.0
    Win32 Version: 2009.11.16.1
    CodeBase: file:///D:/Release试用版/foxtable.exe
----------------------------------------
Interop.MSDASC
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///D:/Release试用版/Interop.MSDASC.DLL
----------------------------------------
o6wa0jbc
    Assembly Version: 0.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Web
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll
----------------------------------------
C1.Win.C1BarCode.2
    Assembly Version: 2.0.20093.36
    Win32 Version: 2.0.20093.36
    CodeBase: file:///D:/Release试用版/C1.Win.C1BarCode.2.DLL
----------------------------------------
System.Drawing.Design
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing.Design/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.Design.dll
----------------------------------------
C1.Win.C1Chart.2
    Assembly Version: 2.0.20092.19168
    Win32 Version: 2.0.20092.19168
    CodeBase: file:///D:/Release试用版/C1.Win.C1Chart.2.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


 


此主题相关图片如下:qq截图未命名.png
按此在新窗口浏览图片
[此贴子已经被作者于2009-12-4 12:51:37编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2009/12/4 13:08:00 [只看该作者]

加上大扩号看看


 回到顶部
帅哥哟,离线,有人找我吗?
菜鸟foxtable
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 菜鸟中的老鸟
等级:七尾狐 帖子:1486 积分:10064 威望:0 精华:9 注册:2008/11/14 8:54:00
  发帖心情 Post By:2009/12/4 13:19:00 [只看该作者]

以下是引用狐狸爸爸在2009-12-4 13:08:00的发言:

加上大扩号看看

这个应该没关系吧,其他表都行,就这表复杂些就有问题。

[此贴子已经被作者于2009-12-4 13:20:31编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2009/12/4 13:22:00 [只看该作者]

类型应该是SQLQuery


 回到顶部
帅哥哟,离线,有人找我吗?
菜鸟foxtable
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 菜鸟中的老鸟
等级:七尾狐 帖子:1486 积分:10064 威望:0 精华:9 注册:2008/11/14 8:54:00
  发帖心情 Post By:2009/12/4 13:25:00 [只看该作者]

以下是引用狐狸爸爸在2009-12-4 13:22:00的发言:

类型应该是SQLQuery

SQLQuery结果是一样的。出错。搞不明白错在哪。SQL里显示是正常的。

[此贴子已经被作者于2009-12-4 13:25:42编辑过]

 回到顶部