我一直在阅读几本书中的依赖属性,但都有一个共同点,它们只是告诉我们它们是如何实现的(使用static readonly DependencyProperty
等),但没有告诉它们从内部工作的确切方式.
我的意思是它们被实现为静态但仍然适用于所有对象.
第二点混淆是附加属性.
有没有可以轻松解释所有这些概念的教程?
在我的应用程序中,我正在使用此处说明的用户设置.然后我意识到在VS 2010中我使用的是.NET 4.0,而只有.NET 2.0就足够了.
当我更改框架并构建项目时,每当我现在访问设置时,在我的代码中,我收到以下错误:
为userSettings/Vegi_Manager.Properties.Settings创建配置节处理程序时出错:无法加载文件或程序集'System,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'或其依赖项之一.该系统找不到指定的文件.(C:\ Users\AKSHAY\AppData\Local\Microsoft\Vegi-Manager.vshost.exe_Url_44035dlkzpfaaauiqsd4nh3f0l0yq0tv\1.0.0.0\user.config第5行)
这是使用4.0版的未知原因.请建议我该怎么做.
我有一个,DataGridView
并希望使标题文字大胆.我试过更改ColumnHeaderDefaultCellStyle
为
DataGridViewCellStyle { BackColor=Color [Control], SelectionBackColor=Color [Highlight], SelectionForeColor=Color [HighlightText], Font=[Font: Name=Tahoma, Size=9.75, Units=3, GdiCharSet=0, GdiVerticalFont=False], WrapMode=True, Alignment=MiddleCenter }
在设计器中,我可以看到Headers为Bold,但在运行时它显示为正常.请没有,除了ColumnHeaderDefaultCellStyle
我也在发生变化
DefaultCellStyle
的DataGridView
,以及各个列.
如何使标题变粗?
在我的应用程序中,当我尝试使用此代码获取连接字符串时:
System.Configuration.ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString;
Run Code Online (Sandbox Code Playgroud)
它抛出"配置系统无法初始化"的异常.app.config的格式在哪里错了?
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="ConStr" connectionString="Integrated Security=false;Persist Security Info=False;User ID=funny;password=veryfunny;Initial Catalog=vegimanager;Data Source=.\sqlexpress;"/>
</connectionStrings>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="Vegi_Manager.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<userSettings>
<Vegi_Manager.Properties.Settings>
<setting name="FIRMNAME" serializeAs="String">
<value/>
</setting>
<setting name="FIRMADDRESS" serializeAs="String">
<value/>
</setting>
<setting name="FIRMCITY" serializeAs="String">
<value/>
</setting>
<setting name="FIRMSTATE" serializeAs="String">
<value/>
</setting>
<setting name="FIRMPHONE" serializeAs="String">
<value/>
</setting>
<setting name="FIRMMOBILE" serializeAs="String">
<value/>
</setting>
<setting name="FIRMEMAIL" serializeAs="String">
<value/>
</setting>
<setting name="FIRMTIN" serializeAs="String">
<value/>
</setting>
<setting name="FIRMPAN" …
Run Code Online (Sandbox Code Playgroud) 我正在阅读的那本书说明了这一点
SQL Server支持两种字符数据类型 - 常规和Unicode.常规数据类型包括CHAR和VARCHAR,Unicode数据类型包括NCHAR和NVARCHAR.不同之处在于常规字符为每个字符使用一个字节的存储空间,而Unicode字符每个字符需要两个字节.每个字符有一个字节的存储空间,选择列的常规字符类型会限制除了英语之外只有一种语言,因为只有256(2 ^ 8)个不同的字符可以用单个字节表示.
我所知道的是,如果我使用Varchar,那么我只能使用一种语言(例如印地语,印度语)和英语.
但是当我跑这个
Create Table NameTable
(
NameColumn varchar(MAX) COLLATE Indic_General_90_CI_AS_KS
)
Run Code Online (Sandbox Code Playgroud)
它显示错误"只有Unicode数据类型支持Collation'Indra_General_90_CI_AS_KS',不能应用于char,varchar或text数据类型."
那么我在哪里误解了作者呢?
谢谢
请考虑以下代码.
CityCode加入了City和CitPlace.
我想要做的是在CityPlace和City之间执行LEFT OUTER JOIN.
City[] cities = new City[]{
new City{CityCode="0771",CityName="Raipur",CityPopulation="BIG"},
new City{CityCode="0751",CityName="Gwalior",CityPopulation="MEDIUM"},
new City{CityCode="0755",CityName="Bhopal",CityPopulation="BIG"},
new City{CityCode="022",CityName="Mumbai",CityPopulation="BIG"},
};
CityPlace[] places = new CityPlace[]{
new CityPlace{CityCode="0771",Place="Shankar Nagar"},
new CityPlace{CityCode="0771",Place="Pandari"},
new CityPlace{CityCode="0771",Place="Energy Park"},
new CityPlace{CityCode="0751",Place="Baadaa"},
new CityPlace{CityCode="0751",Place="Nai Sadak"},
new CityPlace{CityCode="0751",Place="Jayendraganj"},
new CityPlace{CityCode="0751",Place="Vinay Nagar"},
new CityPlace{CityCode="0755",Place="Idgah Hills"},
new CityPlace{CityCode="022",Place="Parel"},
new CityPlace{CityCode="022",Place="Haaji Ali"},
new CityPlace{CityCode="022",Place="Girgaon Beach"},
new CityPlace{CityCode="0783",Place="Railway Station"}};
Run Code Online (Sandbox Code Playgroud)
我做的是
var res = places.GroupJoin(cities,
p1=>p1.CityCode,
c1=>c1.CityCode,
(p2,c2s)=>new {Place=p2.Place,
CityName=c2s.Count()==0 ? "NO NAME"
: c2s.First().CityName });
foreach(var v in res)
Console.WriteLine(v);
Run Code Online (Sandbox Code Playgroud)
这是标准还是快速而肮脏的解决方案?
我正在使用ILMerge将已使用的库合并到控制台应用程序中.合并后,生成的exe只在一秒内完成执行并在后台运行(不显示其输出Console.WriteLine
).
我可以做什么来实际将其作为控制台应用程序运行?
我有一个app.exe.config文件,我试图通过XmlDocument读取它.但是,以下代码不起作用(将值作为null):
XmlDocument appSettingsDoc = new XmlDocument();
appSettingsDoc.Load(@"C:\DBUpgraderConfig\DBUpgrader.exe.config");
XmlNode node = appSettingsDoc.SelectSingleNode("//appSettings");
XmlElement value = (XmlElement)node.SelectSingleNode("UserName");
Run Code Online (Sandbox Code Playgroud)
这是XML:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="Server" value="Xeon-s7\MSSQL2008"/>
<add key="Username" value=""/>
<add key="Password" value=""/>
</appSettings>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
Run Code Online (Sandbox Code Playgroud) 我将所有Crystal Reports保存在一个文件夹中:
VOUCHERS-->SALE-->BILLFORMATS
Run Code Online (Sandbox Code Playgroud)
例如:第一份报告的位置是:
VOUCHERS-->SALE-->BILLFORMATS-->BillFormat1.rpt
Run Code Online (Sandbox Code Playgroud)
Vegi_Manager是根名称空间.
当我构建项目并尝试在代码中使用报表时,它会抛出一个错误:
Unable to find the report in the manifest resources
Run Code Online (Sandbox Code Playgroud)
.cs文件有问题吗?
代码:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Vegi_Manager.VOUCHERS.SALE.BILLFORMATS {
using System;
using System.ComponentModel;
using CrystalDecisions.Shared;
using CrystalDecisions.ReportSource;
using CrystalDecisions.CrystalReports.Engine;
public class BillFormat1 : ReportClass {
public BillFormat1() {
}
public override …
Run Code Online (Sandbox Code Playgroud) 当我插入这些值
09/30/2013 05:04:56.599
09/30/2013 05:04:56.599
09/30/2013 05:04:56.599
09/30/2013 05:04:57.082
Run Code Online (Sandbox Code Playgroud)
在SqlServer数据库中,毫秒值以奇怪的方式变化
2013-09-30 05:04:56.600
2013-09-30 05:04:56.600
2013-09-30 05:04:56.600
2013-09-30 05:04:57.083
Run Code Online (Sandbox Code Playgroud)
怎么了 ?
编辑:相关代码:
com = new SqlCommand();
com.Connection = con;
com.CommandText = @"INSERT INTO [AuthSourceTimings]
([FileName]
,[JobID]
,[JobCreationTime]
,[JobSendTime]
,[JobAckTime]
,[JobDoneTime])
VALUES
(@FileName
,@JobID
,@JobCreationTime
,@JobSendTime
,@JobAckTime
,@JobDoneTime)
";
com.Parameters.AddWithValue("@FileName", fileName);
com.Parameters.AddWithValue("@JobID", t.JobID);
com.Parameters.AddWithValue("@JobCreationTime", t.JobCreationTime == DateTime.MinValue ? (object)DBNull.Value : (object)t.JobCreationTime);
com.Parameters.AddWithValue("@JobSendTime", t.JobSendTime == DateTime.MinValue ? (object)DBNull.Value : (object)t.JobSendTime);
com.Parameters.AddWithValue("@JobAckTime", t.JobAcknowledgementTime == DateTime.MinValue ? (object)DBNull.Value : (object)t.JobAcknowledgementTime);
com.Parameters.AddWithValue("@JobDoneTime", t.JobCompletionTime == DateTime.MinValue ? …
Run Code Online (Sandbox Code Playgroud) c# ×9
app-config ×3
.net ×2
sql-server ×2
winforms ×2
collation ×1
datagridview ×1
datetime ×1
ilmerge ×1
sql ×1
wpf ×1