小编ede*_*son的帖子

ConfigurationManager.GetSection返回null

这是我的app.config

<configuration>
  <configSections>
      <section name="procedureList" type="System.Configuration.NameValueSectionHandler, System, Version=4.0.30319, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
  </configSections>

  <procedureList>
    <add key="NAS.spBusObjGetLineProd" value="@area='Melt Shop';@endDt=?date?;@dayonly=1;@obj='Melt Shop Business Objective" />
    <add key="NAS.spBusObjGetLineProd" value="@area='Cold Mill';@endDt=?date?;@dayonly=1;@obj='Cold Mill Business Objective" /> 
  </procedureList>
  <appSettings>
    <add key="Connstr" value=""/>
    <add key="Userid" value=""/>
    <add key="Timeout" value=""/>
  </appSettings>

</configuration>
Run Code Online (Sandbox Code Playgroud)

但是当我在代码中调用它时,我得到了null

public void samplemethod()
{
    NameValueCollection nvc = ConfigurationManager.GetSection("procedureList") as NameValueCollection;
    string[] keys = nvc.AllKeys;
}
Run Code Online (Sandbox Code Playgroud)

我很感激任何帮助指出我做错了什么

c# app-config

13
推荐指数
2
解决办法
3万
查看次数

在FirebirdSql中,如何从过程返回异常消息

我想在发生异常时从过程返回错误消息.在SQL Server中,您将选择Error_Number()和Error_Message().我将如何在FirebirdSql中执行此操作

SET TERM ^ ;

CREATE PROCEDURE sprocname
 ( id int ) 
RETURNS 
 ( gcode int, errmsg varchar(250) )
AS 
BEGIN
  gcode = 0;
  errmsg = '';
  -- do procedure code here


  WHEN ANY DO
  BEGIN 
    gcode = gdscode; -- ??
    errmsg = ??;
  END
  SUSPEND;
END^

SET TERM ; ^
Run Code Online (Sandbox Code Playgroud)

firebird firebird2.1 firebird2.5

7
推荐指数
1
解决办法
4286
查看次数

你如何将 html 和 value 输出到一个字符串

给定这个 html 输入元素,<input id="input1" type="text" />

如果用户输入“test”的值,jQuery 是否可以将其序列化为字符串?

我要寻找的输出是, <input id="input1" type="text" value="test" />

我没有将它复制到 DOM 中的另一个元素,我需要实际的字符串,以便我可以将它发送到 EVOPdf。我已经尝试过 clone(true),但它没有给我用户在输入中输入的任何值。

我不得不解析 html() 字符串并为每个输入插入一个值,除非有人知道更好的方法。

javascript jquery

5
推荐指数
1
解决办法
2113
查看次数

如何在.net 4.0中设置configSection

我正在尝试为.net 4.0项目设置configSection。

<configuration>
  <configSections>
    <section name="MonitorFldrSection"
         type="System.Configuration.NameValueFileSectionHandler, System, Version=4.0.0.0"
          allowLocation="true"
          allowDefinition="Everywhere"/>
  </configSections>
  <MonitorFldrSection>
    <add name="fldr1" value="C:\Temp" />
    <add name="fldr2" value="C:\Projects" />
  </MonitorFldrSection>
  <connectionStrings>
  </connectionStrings>
  <appSettings>
  </appSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试添加密钥时,得到的提示都是注释或CDATA提示

当我尝试访问代码

object obj = ConfigurationManager.GetSection("MonitorFldrSection");
Run Code Online (Sandbox Code Playgroud)

我收到此错误:{“为MonitorFldrSection创建配置节处理程序时发生错误:无法加载文件或程序集'System,Version = 4.0.0.0'或其依赖项之一。系统找不到指定的文件。(C: \ Projects_4.0 \ NasImageIndexer \ TestForm \ bin \ Debug \ TestForm.exe.Config第5行)“}

除了NameValueFileSectionHandler之外,我还尝试了AppSettingsSection和DictionarySectionHandler。

我究竟做错了什么?

app-config c#-4.0

5
推荐指数
1
解决办法
6047
查看次数

视频标签在IE 9中不起作用

我正在构建的视频标签在IE9中不起作用.它在Firefox和Chrome中运行正常.

我将mime添加到IIS 7.5服务器Extension = .mp4 Mime Type = video/mp4

我使用此代码使用jQuery创建元素

function fsuccLoadVideo(data) {
    var arr = GetNormalizeMetadataClean(data);
    var vid = $('<video width=400 height=300 controls poster=' + arr[0]["CntrTestVideoImage"] + '/>');
    var loc = window.location.href;
    var idx = loc.lastIndexOf('/') + 1;
    var mp4loc = loc.substr(0, idx)+ arr[0]["CntrTestVideoMp4Src"];
    loc =  loc.substr(0, idx)+ arr[0]["CntrTestVideoOggSrc"];
    if ((arr[0]["CntrTestVideoMp4Src"] != undefined) && (arr[0]["CntrTestVideoMp4Src"].length > 0)) {
        $("<source />", { src: loc, type: 'video/webm; codecs="vp8, vorbis"' }).appendTo(vid);
        $("<source />", { src: mp4loc, type: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"' }).appendTo(vid);
        $("<source …
Run Code Online (Sandbox Code Playgroud)

video jquery html5 internet-explorer-9

1
推荐指数
1
解决办法
3891
查看次数