这是我第一次尝试构建ASP.NET服务器控件.编写控制代码很简单,但我遇到了试图控制网页的障碍.
我在一个项目中构建了控件,并在另一个项目中引用了它.在第二个项目中,我将控件放入工具箱并在页面上拖放控件.我可以无错误地编译Web项目,但是当我浏览到该页面时,我收到此错误:
分析器错误消息:未知的服务器标记'cc1:StandardControl1'.
做一些环顾四周我看到其他人出于各种原因出现这个问题,但似乎没有一个适用于我的情况.一种解决方案是将程序集添加到寄存器标记,但这不是我的页面的问题:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="another.aspx.vb" Inherits="Educate.another" %>
<%@ Register Assembly="ServerControlSandbox" Namespace="ServerControlSandbox" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<cc1:StandardControl1 runat="server">
</cc1:StandardControl1>
</div>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
另一个解决方案是将其添加到web.config,再次使用assembly属性.但是在我的web.config中我仍然得到错误:
<controls>
<add tagPrefix="cc1" namespace="ServerControlSandbox" assembly="ServerControlSandbox"/>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
Run Code Online (Sandbox Code Playgroud)
我想我有一些简单的东西,但我认为没有错,从我看过的例子来看.有没有人有任何想法?谢谢.
另外,这是控制代码:
namespace ServerControlSandbox
{
[DefaultProperty("Text")]
[ToolboxData("<{0}:StandardControl1 runat=server></{0}:StandardControl1>")]
public class StandardControl : WebControl
{
[Bindable(true)] …Run Code Online (Sandbox Code Playgroud) 昨天我们将PostgreSQL数据库升级到版本9.1.3.我们认为我们已经测试并准备好了所有内容,但我们错过了一项功能.它返回一个这样的表类型:
CREATE OR REPLACE FUNCTION myfunc( patient_number varchar
, tumor_number_param varchar, facility_number varchar)
RETURNS SETOF patient_for_registrar
LANGUAGE plpgsql
AS
$body$
BEGIN
RETURN QUERY
SELECT cast(nfa.patient_id_number as varchar),
...
Run Code Online (Sandbox Code Playgroud)
我只给出了select的第一列,因为那是错误发生的地方.在今天之前这个函数运行正常,但现在它给出了这个错误:
错误:查询结构与函数结果类型不匹配
详细信息:返回类型字符变化与第1列中的预期类型字符(8)不匹配.其中:PL/pgSQL函数"getwebregistrarpatient_withdeletes"第3行在RETURN QUERY [SQL State = 42804 ]
列nfa.patient_id_number是文本,并正在施放的列patient_id_number中patient_for_registrar是varchar(8).在阅读了一些之后我认为问题是因为从文本转换时没有指定列长度.但问题是我尝试了各种子串组合来解决这个问题,但没有人解决问题:
substring(cast(nfa.patient_id_number as varchar) from 1 for 8),
cast(substring(nfa.patient_id_number from 1 for 8) as varchar),
cast(substring(nfa.patient_id_number from 1 for 8) as varchar(8)),
Run Code Online (Sandbox Code Playgroud)
有没有人有任何指针?