小编Kob*_*kie的帖子

EF 5 - 传递的主键值的数量必须与实体上定义的主键值的数量相匹配

我在使用EF5时遇到了此错误消息.想知道是否有人有这个答案.

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Budget.Data
{

    [Table("BudgetItems")]
   public class BudgetItemRepository
    {
         [Column("MdaCode")]
        public int MDACode { get; set; }
        [Column("PersonalCost")]
        public double PersonnelCost { get; set; }
        [Column("OverheadCost")]
        public double OverheadCost { get; set; }
        [Column("RecurrentCost")]
        public int RecurrentCost { get; set; }
        [Column("CapitalCost")]
        public double Capital { get; set; }

        public double Allocation { get; set; }
        [Column("BudgetYear")]
        public String BudgetYear { get; set; }
         [Column("RecordCreatedDate")]
        public DateTime DateCreated …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework entity-framework-4

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

未定义引用`TextOutA @ 20'

我有点坚持这一点,并希望得到帮助解决这个问题.我正在使用窗口GDI,并根据此链接,包括windows.h是使用TextOut函数所需的,但我仍然得到一些未定义的引用错误消息,我被卡住了.

**未定义引用`TextOutA @ 20'|

未定义引用`CreateDCA @ 16'|

未定义引用`Escape @ 20'|

未定义引用`DeleteDC @ 4'|**

#include <Windows.h>// HDC is a typedef defined in the windows.h library
#include <stdlib.h>
#include <stdio.h>
#include <fstream>
#include <strstream>
#include <string.h>
using namespace std;

#define IDM_QUIT 102
#define EXAMPLE 101
#define IDM_PRINT  27
#define IDM_SHOW 1

//this excerpt demonstrates how to get the handle to a device context ysing the BegingPaint() GDI function
long FAR PASCAL _export WINDOWPROCEDURE(HWND hwnd, UINT message, UINT wParam, LONG Param)
{
    HDC …
Run Code Online (Sandbox Code Playgroud)

c++ windows winapi

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

Winforms - 在文本框中显示的文本的下划线部分

我有一行要显示的文本,我想要做的只是在显示中仅显示文本的标题部分.我该如何做到这一点?

消息:这是客户名称的消息.

"消息:"加下划线的位置.

c# winforms

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

MS Access SQL查询 - 查询表达式中的语法错误(缺少运算符)

我试图理解为什么我的查询(下面)在我运行它时在MS Access Sql查询编辑器(sqlview)中显示错误消息.

SELECT *
FROM tblUSPS
INNER JOIN   tblProductUSPS 
ON tblProductUSPS.[PRODUCTUSPS_USPS] = tblUSPS.[USPS_CODE] 
INNER JOIN  tblAttribute 
ON tblUSPS.USPS_ID = tblAttribute.ATTRIBUTE_USPSID
Run Code Online (Sandbox Code Playgroud)

据我所知,如果我删除任何一个INNER连接线,下面的脚本.例如,此脚本运行时没有错误

SELECT *
FROM tblUSPS
INNER JOIN   tblProductUSPS 
ON tblProductUSPS.[PRODUCTUSPS_USPS] = tblUSPS.[USPS_CODE] 
Run Code Online (Sandbox Code Playgroud)

这也是如此

SELECT *
FROM tblUSPS  
INNER JOIN  tblAttribute ON tblUSPS.USPS_ID = tblAttribute.ATTRIBUTE_USPSID
Run Code Online (Sandbox Code Playgroud)

但是当我结合起来时,出现了问题,我无法找到它,所以我希望得到一些帮助.

sql database vbscript ms-access vba

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

Android Java模拟器..警告:数据分区已在使用中.变化不会持续

我正在尝试在Eclipse中运行Android项目(Android 2.3.3,在Windows 7 64位计算机上),但我遇到以下错误(在控制台窗口上).这工作在几个小时前,但现在没有,我认为我没有改变任何重大.非常感谢我能解决这个问题的任何帮助

[2012-09-02 17:38:33 - mapviewballoons.Main] Starting incremental Pre Compiler: Checking resource changes.
[2012-09-02 17:38:33 - mapviewballoons.Main] Nothing to pre compile!
[2012-09-02 17:38:33 - samplemap] Refreshing resource folders.
[2012-09-02 17:38:35 - Emulator] WARNING: Data partition already in use. Changes will not persist!
[2012-09-02 17:38:35 - Emulator] WARNING: SD Card image already in use: C:\Users\MACHINEOVA\.android\avd\MAPAPP1.avd/sdcard.img
[2012-09-02 17:38:35 - Emulator] WARNING: Cache partition already in use. Changes will not persist!
Run Code Online (Sandbox Code Playgroud)

eclipse android

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

为什么Console.Readline没有按预期执行

我在下面使用以下代码来处理.我在这里遇到的问题是代码在while循环中运行而不等待String temp = Console.ReadLine()行的输入.需要帮助了解为什么以及如何修复请.提前致谢!

   /*Banker's algorithm Implementation*/
  class Program
  {

        static void Main(string[] args)
        {
              int n = 0;//number of resources we will  be dealing with
              int proc_num = 0;//Total number of processes to share available resources

              IDictionary<String, SysProcess> processes = new Dictionary<String, SysProcess>();
              IDictionary<String, int> MaxR = new Dictionary<String, int>();// maximum available resources
              IDictionary<String, int> avail = new Dictionary<String, int>();// Available resources after first allocation
              Dictionary<String, int> availsum = new Dictionary<string, int>();

              //Start  
              while (true)
              {
                    Console.WriteLine(" …
Run Code Online (Sandbox Code Playgroud)

.net c# windows console-application

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

OO中的单元测试和访问修饰符

我注意到为了在我的OO代码中对每个单元进行单元测试,我需要将访问修饰符设置为public,即使是应该受到保护的方法,也可能是私有的.这可以吗?

public class EnforceBusinessRules
{
    BusinessState m_state;

    public EnforceBusinessRules()
    {
        m_state = START;
    }


    public bool isInputcurrentlyFormatted(string input)
    {
        //code goes here to ensure the input passes formatting test
        //modify m_state appropriately
    }


    public bool InputContainsValidStartAndEndTokens(string input)
    {
        //code goes here to ensure that the start and end tokens of the input are of the type available in the system
        //modify m_state appropriately
    }


    public bool StartEndCommandisValidAccordingtoCurrentSystemSettings(string input)
    {
        //code goes here to check the start and End codes match …
Run Code Online (Sandbox Code Playgroud)

.net c# c++ nunit unit-testing

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

MS Access从子属性设置父窗体属性

如何从子表单属性设置父表单属性(父表单中的属性)的访问权限?

vbscript ms-access vba

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

CSS如何使div水平居中

我正在努力使 div 水平居中。我有以下代码将我的 div 垂直和水平地居中在 body 标记中,但似乎只有垂直部分有效。我怎样才能让水平部分也能工作。提前致谢。

body
{
    background-color: #081418;
    font-size: .75em;
    font-family: Verdana, Helvetica, Sans-Serif;
    margin: 0;
    padding: 0;
    color: #696969; 
    text-align: center;
}

.OuterRim
{
    border:5px solid #99D7C0;
    height: 97%;
    width: 85%;
    /*center aligning*/ 
    display: block;
    text-align: left;
    margin: 0px auto;

}
Run Code Online (Sandbox Code Playgroud)

html css

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

使用XmlIgnoreAttribute忽略基类属性

我有一个抽象的基类,我已经添加了一些虚拟属性.我想要的是,在我的派生类中,指定在序列化(和反序列化过程)期间忽略特定的基类属性.如下所示,-class中的Value-property BaseClass声明为virtual属性,而在DerivedClass-class中,使用overrides-keyword,我选择覆盖基类的ppty,然后将-Attribute放在XmlIgnoreAttribute它上面.但是,当我测试代码时,我仍然会Value在生成的XML中找到包含在派生类实例中的ppty.定义ppty也会发生同样的事情,即使我使用new关键字将它隐藏在Derived类中,它也会被渲染,然后也将XMLIgnoreAttribute应用于它.请问以下代码有什么问题?

public abstract class BaseClass
{
    public virtual String Value { get; set; }

     public String Definition { get; set; }

    [XmlAttribute("SeparatorCharacter")]
    public virtual String SeparatorCharacter { get; set; }
}


public class DerivedClass:BaseClass
{
    [XmlIgnore()]
    public overrides String Value { get; set; }

    [XmlAttribute("FillerCharacter")]
    public String FillValue { get; set; }

     [XmlIgnore()]
    public new String Definition { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

.net c# xml serialization

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