public interface ITest
{
int ChildCount { get; set; }
}
public class Test
{
}
public class OrderPool : ITest, Test
{
public int ChildCount
{
get;
set;
}
}
Run Code Online (Sandbox Code Playgroud)
错误说Base类'Test'必须在任何接口之前.为什么有必要先扩展类然后实现接口?
我有一个post build事件,写入一个文本文件.当我从Visual Studio构建项目时它工作正常.但是当我使用msbuild.exe时,Post构建事件不会写入文件.我正在使用带有以下参数的msbuild:
msbuild.exe TestProj.Web.csproj /p:Configuration=Release /p:OutDir=C:\TestProj\bin\ /p:WebProjectOutputDir=C:\TestProj\ /p:DebugSymbols=false /p:DebugType=None
Run Code Online (Sandbox Code Playgroud)
post build事件如下所示:
<PropertyGroup Condition="'$(BUILD_NUMBER)'==''">
<COMPUTERNAME>None</COMPUTERNAME>
<BRANCH>None</BRANCH>
<BUILD_NUMBER>None</BUILD_NUMBER>
</PropertyGroup>
<Target Name="AfterBuild">
<WriteLinesToFile File="$(ProjectDir)$(OutputPath)\VersionInfo.txt" Overwrite="true" Lines="Project
Created On $(COMPUTERNAME)
Branch is $(BRANCH)
Version Is $(BUILD_NUMBER)" />
</Target>
Run Code Online (Sandbox Code Playgroud) 我试过Application_Error像这样的代码
Session["mysession"] = "Some message";
Run Code Online (Sandbox Code Playgroud)
但问题是有时会话不可用Application_Error.所以我想检查会话是否可用.
我试图使用Liquibase部署数据库更改并在其中一个存储过程代码上获得以下错误.
SET NOCOUNT ON: Incorrect syntax near 'ON'.
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:104)
at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:1075)
at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:1059)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:317)
... 5 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near 'ON'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1493)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:775)
at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:676)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:179)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:154)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:649)
at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:92)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
Run Code Online (Sandbox Code Playgroud)
sp看起来像:
CREATE PROCEDURE [dbo].[TestSP]
AS
BEGIN
SET NOCOUNT ON;
SELECT Col1, Col2
FROM dbo.[Table1]
END
GO
GRANT EXECUTE ON [dbo].[testsp] TO [SomeRole]
GO
Run Code Online (Sandbox Code Playgroud)
变更集看起来像:
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" …Run Code Online (Sandbox Code Playgroud) SELECT [SomeColumn]
FROM [Table1] t1
WHERE Table1ID = (
SELECT [Table1ID]
FROM [Table2] t2
WHERE t2.ID = 2
OPTION (MAXDOP 4)
)
OPTION (MAXDOP 4)
Run Code Online (Sandbox Code Playgroud)
这会在子查询中Incorrect syntax near the keyword 'OPTION'.首先出现错误OPTION (MAXDOP)
是否可以使用OPTION (MAXDOP?或者最终OPTION (MAXDOP)将足以设置子查询的程度.
当我尝试从C#代码执行下面的存储过程时,我得到一个SQLException"操作数类型碰撞:int与uniqueidentifier不兼容".
create proc sp_Get_Allfields_Account_Public
@username varchar(20),
@password varchar(20),
@acc_num UniqueIdentifier out,
@cust_name varchar(20) out,
@balance float out
as
select @acc_num=acc_num,@cust_name=cust_name,@balance=balance from Account_Public where username=@username and password=@password
Run Code Online (Sandbox Code Playgroud)
C#代码如下
cmd = new SqlCommand("sp_Get_Allfields_Account_Public", con);
cmd.CommandType = CommandType.StoredProcedure;
// Add Input Parameters
cmd.Parameters.AddWithValue("@username", username);
cmd.Parameters.AddWithValue("@password", password);
// Add output parameters
cmd.Parameters.AddWithValue("@acc_num", SqlDbType.UniqueIdentifier);
cmd.Parameters["@acc_num"].Direction = ParameterDirection.Output;
cmd.Parameters.AddWithValue("@cust_name", SqlDbType.VarChar);
cmd.Parameters["@cust_name"].Direction = ParameterDirection.Output;
cmd.Parameters.AddWithValue("@balance", SqlDbType.Float);
cmd.Parameters["@balance"].Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
Run Code Online (Sandbox Code Playgroud)
表定义
create table Account_Public
(
acc_num uniqueidentifier,
cust_name varchar(20),
username varchar(20),
password varchar(20),
balance float
)
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Teamcity REST API 创建一个 VCS Root。按照REST 文档,我将在 XML 下方发布到http://TeamcityServer/httpAuth/app/rest/vcs-roots
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vcs-root name="TestVCS" vcsName="svn" modificationCheckInterval="5" href="/httpAuth/app/rest/vcs-roots/id:TestVCS">
<project id="TestProject" name="<Root project>" href="/httpAuth/app/rest/projects/id:TestProject"/>
<properties>
<property name="externals-mode" value="externals-full"/>
<property name="labelingMessage" value="Labeled automatically by TeamCity"/>
<property name="labelingPatterns" value="trunk=>tags"/>
<property name="svn-config-directory" value="C:\Windows\system32\config\systemprofile\AppData\Roaming\Subversion"/>
<property name="svn-use-default-config-directory" value="true"/>
<property name="url" value="https://svn-uat.net/TestProject"/>
<property name="user" value="testuser"/>
<property name="password" value="testpwd"/>
<property name="working-copy-format" value="1.6"/>
</properties>
<vcsRootInstances href="/httpAuth/app/rest/vcs-root-instances?locator=vcsRoot:(id:TestVCS)"/>
</vcs-root>
Run Code Online (Sandbox Code Playgroud)
这将创建 VCS 根,但密码属性仍为空。我尝试使用 明确设置密码http://TeamcityServer/httpAuth/app/rest/vcs-roots/VCSId/properties/password,但即使这样似乎也没有为 VCS 根设置密码。
我正在使用System.Windows.Forms.RichTextBox和做类似的事情
RichTextBox1.Text = "Hello World";
Run Code Online (Sandbox Code Playgroud)
但在此语句之后,RichTextBox中的光标位置仍然在开头.有没有办法将它设置到最后?
我想写一个像C#的方法
public bool PowershellExists()
{
// Returns true if PowerShell exists on the machine, else false.
}
Run Code Online (Sandbox Code Playgroud) class Person
{
string name;
public Person(string name)
{
this.name = name;
}
public void method()
{
Person gupta = new Person("James"); // Current Object
Console.WriteLine(this.name);
Person gupta1 = new Person("Peter"); // Current Object
Console.WriteLine(this.name);
Person gupta2 = new Person("Frank"); // Current Object
Console.WriteLine(this.name);
}
static void Main(string[] args)
{
Person p = new Person("Jim");
p.method();
Console.ReadLine();
}
}
Run Code Online (Sandbox Code Playgroud)
这段代码产生了结果
Jim
Jim
Jim
Run Code Online (Sandbox Code Playgroud)
但是,如果认为这应该是
James
Peter
Frank
Run Code Online (Sandbox Code Playgroud)
有人可以解释一下吗?
c# ×7
.net ×2
asp.net ×2
inheritance ×1
java ×1
liquibase ×1
msbuild ×1
powershell ×1
sql ×1
sql-server ×1
t-sql ×1
teamcity ×1
teamcity-8.0 ×1
this ×1