是否有一种简单的方法可以将人的用户设置存储在sql 2000数据库中.理想情况下,所有设置都在一个字段中,因此每次添加设置时都不必编辑表格.如果有人举例,我正在考虑序列化设置类.
我不想使用存储在持久存储中的内置.NET用户设置的原因是工作使用超级强制配置文件,因此在用户注销时清除设置很麻烦.我之前发布了要求任何解决方案,但没有得到太多回应.
我正在查看有关asp.net的大量页面的性能建议.具体来说,删除未使用的httpmodules部分:
<httpModules>
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule"/>
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
<add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule"/>
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule"/>
<add name="PassportAuthentication" type="System.Web.Security.PassportAuthenticationModule"/>
<add name="RoleManager" type="System.Web.Security.RoleManagerModule"/>
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule"/>
<add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule"/>
<add name="AnonymousIdentification" type="System.Web.Security.AnonymousIdentificationModule"/>
<add name="Profile" type="System.Web.Profile.ProfileModule"/>
<add name="ErrorHandlerModule" type="System.Web.Mobile.ErrorHandlerModule, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</httpModules>
Run Code Online (Sandbox Code Playgroud)
这里列出了大量的HTTP模块,我非常肯定,并非所有这些都被您的应用程序使用.删除未使用的HTTP模块肯定会带来轻微的性能提升,因为执行的工作量会减少.假设在应用程序中不需要Windows身份验证.要删除继承的设置,请在web.config应用程序的httpModules部分下添加一个remove元素,并指定不需要的模块的名称.例:
<httpModules>
<remove name="WindowsAuthentication" />
</httpModules>
Run Code Online (Sandbox Code Playgroud)
有没有人知道哪里有各自的描述,有些是显而易见但不是全部,我已经在谷歌上已经有一段时间了.
到目前为止,我还没有需要在 .NET 中创建一个 dll,因为我的程序往往彼此不同(而且我没有编程太久)。然而,我现在开始收集一个经常使用的方法库,这些方法往往在我的许多程序中都有副本(或可以变得更通用的类似方法)。
据我了解,应该创建一个 dll 来共享程序之间的通用方法。
所以我可以把我的方法放在dll中,自定义对话框和常见表单之类的东西呢。我目前有一个自定义错误表单和一个打印预览对话框,几乎在我的所有程序中使用。将这些放在 dll 中是一种好习惯吗?
我有下面的代码来查询存储过程中的记录,但我担心我可能不会处理我需要或正在处理的对象将在不久之后被垃圾收集器清除.
我是否需要处理SqlDataReader,因为它在try catch块中?
我是否需要同时运行cmd.Dispose和cmd.Connection.Close,还是推断另一个?
垃圾收集器最终是否会丢弃所有这些对象(可能不够及时)或者这些对象是否因为使用非托管代码而可能需要处置?
public void GetData(string studentID)
{
SqlCommand cmd = new SqlCommand("sp_stored_proc",
new SqlConnection(Settings.Default.connectionString))
{ CommandType = CommandType.StoredProcedure };
try
{
cmd.Connection.Open();
cmd.Parameters.AddWithValue("@student_id", studentID);
SqlDataReader dr = cmd.ExecuteReader();
//do something with the data
if (dr != null)
dr.Dispose();
}
catch
{
//error handling
}
finally
{
if (cmd != null)
{
cmd.Dispose();
cmd.Connection.Close();
}
}
}
Run Code Online (Sandbox Code Playgroud) 我在大学工作,我们的主要网站有一个基于ASP.NET的课程信息搜索,我创建.这已经变得很受欢迎,我们公司面临的网站(公司培训)要求在他们的网站上使用相同的系统.我没有参与任何一个网站的日常工作,但知道他们是使用Wordpress制作的.是否有可能在某些页面中嵌入一些ASP.NET代码?这样做的任何文章?
编辑: 实际标记中出现的ASP.NET代码是最小的,它主要是一些asp:文字我故意这样做是为了隐藏网站开发人员的大部分内容,以便在事情被意外删除时节省自己的麻烦.
EDIT2有一个回应,因为这是可行的web服务.即作为主页面上的搜索框显示下面的结果.
我有一些复杂的存储过程使用链接服务器从其他数据库中提取数据.此数据被放入临时表中,这些临时表在选择查询中连接以进行输出.这些程序工作正常,但是在visual studio中如果我尝试使用设计器将存储过程添加到数据集中,我会得到错误无效的对象名称#tmp或者调用第一个临时表.它无法检索数据库架构.在ASP.NET中使用和sqldatasource也是一样的.
该过程仍然可用,但我必须手动添加它应输出到数据表的所有列.手动做这将是一件痛苦的事情,我认为它与visual studio收集存储过程的输出字段的方式有关,它似乎不以正常方式运行它.有没有办法纠正这个问题,因为我有很多要做的事情,并且不想手动添加所有列,这既费时又容易出错.
有没有办法找到打印机上的所有打印托盘并获得其纸张尺寸,例如
Tray1 = A4
Tray2 = A3
Tray3 = Letter
Run Code Online (Sandbox Code Playgroud)
我可以看到一种方法来使用这样的东西来获取托盘,但它似乎没有纸张尺寸信息.
using (System.Drawing.Printing.PrintDocument doc = new PrintDocument())
{
foreach (System.Drawing.Printing.PaperSource paperSource in doc.PrinterSettings.PaperSources)
{
string trayName = paperSource.SourceName;
}
}
Run Code Online (Sandbox Code Playgroud)
我想要做的是默认为打印作业选择最佳托盘.
如果我有用户生成的内容,例如:
<p>my paragraph</p>
<ul>
<li>item1</li>
<li>item2</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
这输出段落末尾和列表之间的段落差距如下:
我的段落
我知道我可以通过在UL标签上设置margin-top和在p标签上设置margin-bottom来摆脱CSS中的差距,但有没有办法在不影响实际段落之间的边距的情况下完成.
内容是用户生成的,有一组有限的标签可用,没有字体,大小......可用所以所有格式都应该在CSS中完成,如果可能的话,而不必在标签中放置类.
编辑: 应该把我知道,因为我可以设置的边缘折叠在CSS中的工作方式
p { margin-bottom:0; }
li { margin-top:0; }
Run Code Online (Sandbox Code Playgroud)
在两种情况下分离都是正确的,因为p标签上的margin-top属性仍然是1,但是我已经将margin-top设置为0.2em,以获得h2和p标签之间的较小间隙.
我有一个类似于此的XML文件(删除了更多节点和详细信息):
<?xml version="1.0" encoding="utf-8"?>
<Message xmlns="http://www.theia.org.uk/ILR/2011-12/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>
<CollectionDetails>
<Collection>ILR</Collection>
<Year>1112</Year>
<FilePreparationDate>2011-10-06</FilePreparationDate>
</CollectionDetails>
<Source>
<ProtectiveMarking>PROTECT-PRIVATE</ProtectiveMarking>
</Source>
</Header>
<SourceFiles>
<SourceFile>
<SourceFileName>A10004705001112004401.ER</SourceFileName>
<FilePreparationDate>2011-10-05</FilePreparationDate>
</SourceFile>
</SourceFiles>
<LearningProvider>
<UKPRN>10004705</UKPRN>
<UPIN>107949</UPIN>
</LearningProvider>
<Learner>
<ULN>4682272097</ULN>
<GivenNames>Peter</GivenNames>
<LearningDelivery>
<LearnAimRef>60000776</LearnAimRef>
</LearningDelivery>
<LearningDelivery>
<LearnAimRef>ZPROG001</LearnAimRef>
</LearningDelivery>
</Learner>
<Learner>
<ULN>3072094321</ULN>
<GivenNames>Thomas</GivenNames>
<LearningDelivery>
<LearnAimRef>10055320</LearnAimRef>
</LearningDelivery>
<LearningDelivery>
<LearnAimRef>10002856</LearnAimRef>
</LearningDelivery>
<LearningDelivery>
<LearnAimRef>1000287X</LearnAimRef>
</LearningDelivery>
</Learner>
</Message>
Run Code Online (Sandbox Code Playgroud)
我需要对此进行过滤,以便只有具有ZPROG001的子LearningDelivery LearnAimRef的学习者记录才会显示,因此这种情况下的输出将是第一个学习者而不是第二个学习者:
<?xml version="1.0" encoding="utf-8"?>
<Message xmlns="http://www.theia.org.uk/ILR/2011-12/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>
<CollectionDetails>
<Collection>ILR</Collection>
<Year>1112</Year>
<FilePreparationDate>2011-10-06</FilePreparationDate>
</CollectionDetails>
<Source>
<ProtectiveMarking>PROTECT-PRIVATE</ProtectiveMarking>
</Source>
</Header>
<SourceFiles>
<SourceFile>
<SourceFileName>A10004705001112004401.ER</SourceFileName>
<FilePreparationDate>2011-10-05</FilePreparationDate>
</SourceFile>
</SourceFiles>
<LearningProvider>
<UKPRN>10004705</UKPRN>
<UPIN>107949</UPIN>
</LearningProvider>
<Learner> …Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用带有JSON数据的handontable并且它工作得很好但我需要禁用所有表输入到某些用户(只读视图).
有没有办法完全禁用一个handontable所以没有输入响应和删除行插件不起作用?我试过http://dougestep.com/dme/jquery-disabler-widget-demos这似乎不起作用和http://malsup.com/jquery/block/#element哪个有效,但它本质上创建了一个iframe覆盖控件和使用removerow插件,位置设置不正确.
.net ×3
c# ×3
asp.net ×2
css ×1
database ×1
dll ×1
handsontable ×1
html ×1
javascript ×1
jquery ×1
performance ×1
printing ×1
repost ×1
sql ×1
sql-server ×1
wordpress ×1
xml ×1
xslt ×1