Employee
id, name, datejoin, deptID
Run Code Online (Sandbox Code Playgroud)
和另一个表
Marketing
id, name, deptID
Run Code Online (Sandbox Code Playgroud)
我想要做的是从Marketing中的Employee表中搜索deptID以查看它是否存在,如果它不存在,则想要将Employee表中的name和deptID添加到Marketing表中.基本上我认为它是外部连接.
我想要做的是使用lambda表达式和EF我是这个领域的新手,所以想知道如何实现这一点.我已经创建了实体,需要弄清楚lambda表达式
tTlEntities sde = new tTlEntities();
sde.t_Marketing.Where(x=>x.deptID == t_Employee.deptID).
Run Code Online (Sandbox Code Playgroud)
这就是我走了多远,我知道需要一些外部连接.请帮助
我创建了一个表值类型,它被创建得很好.
CREATE TYPE [ContactTemplate] AS TABLE (
[Email] VARCHAR(100),
[FirstName] VARCHAR(50),
[LastName] VARCHAR(50)
)
GO
Run Code Online (Sandbox Code Playgroud)
然后,当我尝试创建一个过程时:
CREATE PROCEDURE [dbo].[usp_ProcessContact]
( @Email VARCHAR(100),
@FirstName VARCHAR(50),
@LastName VARCHAR(50),
@Contact ContactTemplate READONLY)
as
Begin
-------
End
Run Code Online (Sandbox Code Playgroud)
我一直在收到错误
@Contact ContactTemplate READONLY" The parameter @Contact cannot
be declared READONLY since it is not a table valued parameter
Run Code Online (Sandbox Code Playgroud)
我尝试了很多东西,删除dbo,括号等,仍然无法让它工作.请帮忙..
我有以下sql语句:
select
a.desc
,sum(bdd.amount)
from t_main c
left outer join t_direct bds on (bds.repid=c.id)
left outer join tm_defination def a on (a.id =bds.sId)
where c.repId=1000000134
group by a.desc;
Run Code Online (Sandbox Code Playgroud)
当我运行它时,我得到以下结果:
desc amount
NW 12.00
SW 10
Run Code Online (Sandbox Code Playgroud)
当我尝试添加另一个左外连接以获取另一组值时:
select
a.desc
,sum(bdd.amount)
,sum(i.amt)
from t_main c
left outer join t_direct bds on (bds.repid=c.id)
left outer join tm_defination def a on (a.id =bdd.sId)
left outer join t_ind i on (i.id=c.id)
where c.repId=1000000134
group by a.desc;
Run Code Online (Sandbox Code Playgroud)
它基本上使金额字段翻倍:
desc amount amt
NW 24.00 234.00
SE 20.00 …Run Code Online (Sandbox Code Playgroud) 嗨,我有一个以下查询,检查代码以确定何时输入或查看.
declare @timestamp datetime;
select
case @timestamp
when a.updatedDate =1760 then 'Entered on' +a.updatedDate
when a.updatedDate=1710 then 'Viewed on' +a.updatedDate
else 'Last Updated on'+ a.updatedDate
end
from t_mainTable a
where a.id=@Id;
Run Code Online (Sandbox Code Playgroud)
当我尝试运行此查询时,它给了我错误
Msg 102, Level 15, State 1, Procedure p_xxxx, line 40
Incorrect syntax near '='.
Run Code Online (Sandbox Code Playgroud)
when行中有一些syntex错误.请让我知道如何纠正这个谢谢
嗨,我在SQL Server中有以下select命令.我试图改变它,所以如果b.bId为null我想为它分配0值.所以它在字段中显示0.
select top 1
a.sId
,b.bId
from tlocal a
left outer join ts b on (b.id=a.mainId)
where
a.id=@xId;
Run Code Online (Sandbox Code Playgroud)
请让我知道如何修改.谢谢
使用ng-repeat我正在创建一堆带有值的表单.对于每个表单,还有一个按钮,用新字段向该特定表单添加行.代码如下
HTML:
<div ng-repeat="cont in contacts">
<form ng-submit="newContact()">
<input type="text" class="xdTextBox" ng-model="cont.ac"/>
<input type="text" class="xdTextBox" ng-model="cont.cat"/>
<input type="text" class="xdTextBox" ng-model="cont.loc"/>
<button type="submit">Submit</button>
<a href ng-click="addFields()">Add</a>
</form>
</div>
Run Code Online (Sandbox Code Playgroud)
使用Javascript:
$scope.contacts = [{ ac: '', auth: '', autname: ''}];
$scope.tasks = [];
$scope.addFields = function () {
$scope.contacts.push({ ac: '', auth: '', autname: '' });
console.log($scope.contacts);
}
Run Code Online (Sandbox Code Playgroud)
它正在创建所有表单并添加行但是有两个问题:
请让我知道如何修复它,以便当按下添加按钮时,只创建该特定形式的行,当我在新推送的字段的字段中输入文本时,它只将它绑定到特定的一个而不是所有创建的那些.谢谢
我试图在单击添加按钮后禁用该按钮。为简单起见,我不会仅添加导致问题的代码的详细信息。
<div *ngFor="let n of records">
<span>{{n.name}}</span>
<span>{{n.location}}</span>
<button (click)="addtomainrecord(n)" [disabled]="disablebutton">add</button>
</div>
Run Code Online (Sandbox Code Playgroud)
在我的组件中,我已经声明
disablebutton:boolean=false;
//later in my code
addtomainrecord(record) {
this.disablebutton=true;
//rest of the code follows
}
Run Code Online (Sandbox Code Playgroud)
我面临的问题是,一旦我第一次单击添加按钮,所有按钮都被禁用,而我只想禁用我刚刚单击的行按钮。
如何修复?
我有两个字符串数组,我需要比较相似的字符串.
string[] f1 = {"Ann", "mam", "far", "aBc"};
string[] f2 = {"ann", "nom", "far", "abc"};
Parallel.ForEach(f1, currenFile =>
{
if (f2.Contains(currenFile, StringComparison.OrdinalIgnoreCase))
{
Console.WriteLine("matchfound"+currenFile);
}
});
Run Code Online (Sandbox Code Playgroud)
我试图看看f2是否包含来自f1忽略大小写的单词.但是,知识产权在"StringComparison.OrdinalIgnoreCase"上有错误
参数类型System.StringComparission不能分配给参数类型Systems.Collections.Generic.IEqualityComparer
请让我知道如何解决此错误.
嗨,我有以下linq查询
var query=DbContext.Set<tasksList>()
Select(u=> new { tasks= u.description});
Run Code Online (Sandbox Code Playgroud)
我想要做的是当它描述为null时迭代通过返回一些其他值,例如返回1或任何东西.请让我知道如何实现这一点谢谢
您好,我有以下代码来显示图像。
<div *ngFor="let image of images" >
<span *ngIf=" "> //if img=t.jpg display this line
<label>JPEG Image</label><img src='{{image.img}}'/>
</span>
<span *ngIf=" "> // if img=t.jpg dont display this line
<label>PNG Image</label><img src='{{image.img}}'/>
</span>
</div>
Run Code Online (Sandbox Code Playgroud)
我想提出的条件是,如果图像扩展名是 .jpg 即 image.jpg 我希望显示 JPEG 行,如果它是 .png 即 image.png 我希望显示 PNG 图像行。请告诉我如何读取 *ngIf 中图像/文件的扩展名谢谢