我看到很多关于堆栈溢出的问题,不是它们触及了我自己的问题
过程或函数需要未提供的参数
我创建了这个SQL Server存储过程:
CREATE proc [dbo].[spAddCustomer]
@cuName varchar(50),
@cuAddress varchar(50),
@cuMobile varchar(50),
@cuImage image,
@cityId int,
@exist int output
AS
BEGIN
IF NOT EXISTS(SELECT Cu_Mobile FROM tblCustomers WHERE Cu_Mobile = @cuMobile)
BEGIN
INSERT INTO tblCustomers (Cu_Name, Cu_Address, Cu_Mobile, Cu_Image, City_ID)
VALUES (@cuName, @cuAddress, @cuMobile, @cuImage, @cityId)
SET @exist = 1
END
ELSE
SET @exist = 0
END
Run Code Online (Sandbox Code Playgroud)
在我的数据访问层中,我有这个方法负责非查询命令:
public static int ExecuteNonQuery(string query, CommandType type, params SqlParameter[] arr)
{
int outParam;
SqlCommand cmd = new SqlCommand(query, cn);
cmd.Parameters.AddRange(arr);
cmd.CommandType …Run Code Online (Sandbox Code Playgroud) 我正在尝试反过来的Select方法:根据他们的项目投射一堆物品Id,我想的是Where所以我会做这样的事情:
db.Books.Where(b => b.Id==1 || b.Id==3 || b.Id==5)
Run Code Online (Sandbox Code Playgroud)
但如果我有编号的一个长长的清单,或者如果我想通过搜索Title,这将是非常痛苦的代码,那么有没有办法来检索基于一组值项的列表(如SQL: WHERE id IN..)
我试图让这个工作:
[Route("api/Default")]
public class DefaultController : ApiController
{
[HttpGet, Route("{name}")]
public string Get(string name)
{
return $"Hello " + name;
}
}
Run Code Online (Sandbox Code Playgroud)
通过调用此http://localhost:55539/api/Default?name=rami但不工作,尝试了这个:http://localhost:55539/api/Default/Hello?name=rami,这也不起作用:http://localhost:55539/api/Default/Hello/rami
我以这种形式将文件的uri保存在数据库中:
https://app.blob.core.windows.net/container/Accounts/Images/acc.jpg
Run Code Online (Sandbox Code Playgroud)
但是要删除它,我只需要传递blob名称即可
CloudBlockBlob blockBlob = Container.GetBlockBlobReference(uri);
Run Code Online (Sandbox Code Playgroud)
斑点的完整内容uri变为:
https://app.blob.core.windows.net/container/https://app.blob.core.windows.net/container/Accounts/Images/acc.jpg
所以我得到了404错误(未找到),我可以对进行一些修整,uri但这似乎效率不高。那么有没有办法通过其完整URI删除Blob /获取引用?
我要救true的是答案,并false在无:
<div layout-gt-sm="row">
Insured?
<md-radio-group ng-model="vehicle.insured">
<md-radio-button value="true" class="md-primary">Yes</md-radio-button>
<md-radio-button value="false"> No </md-radio-button>
</md-radio-group>
</div>
Run Code Online (Sandbox Code Playgroud)
它将值保存在数据库中,但它不绑定现有值,因此当用户检索记录时没有选定的答案
我有这个界面:
public interface ISign
{
Task<bool> IsRegisteredCopy();
}
Run Code Online (Sandbox Code Playgroud)
实施它:
public class Sign : ISign
{
TabibContext context = new TabibContext();
public Task<bool> IsRegisteredCopy()
{
return context.Doctors.Any();
}
}
Run Code Online (Sandbox Code Playgroud)
所以我需要Any从不可用的方法返回Task !
我开始使用EF Core 2.0,我有一个针对.NET 4.6.1的控制台应用程序,我有一个非常简单的模型类,并且具有以下上下文:
public class ContextCore : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(ConfigurationManager.ConnectionStrings["efCoreCon"].ConnectionString);
}
public DbSet<ModelC> Models { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
这是连接字符串:
<add name="efCoreCon" connectionString="server=PC-MSHWF\SQLEXPRESS;database=efCoreDB;integrated security=true;" />
Run Code Online (Sandbox Code Playgroud)
我注意到官方文档Enable-Migrations中的ef core中没有命令
所以我跑了,Add-migration firstMigration
但出现了这个错误:
在程序集“ NewConsole”中找不到迁移配置类型。(在Visual Studio中,您可以使用Package Manager控制台中的Enable-Migrations命令来添加迁移配置)。
当我尝试Enable-Migrations时,出现以下错误:
在程序集“ NewConsole”中找不到上下文类型。
我正在尝试为Windows Forms应用程序构建一个设置项目,我从同事那里复制了该项目,我们使用该项目(在他的机器上)来部署该应用程序。我在Visual Studio 2017中安装了安装模板。构建项目时,这些窗口会显示出来,在以下位置查找文件:
d:\aaf5ce84f8decdcaf3b2f1\1033_ENU_LP\redist\VisualStudioShell\VSIntSetup\
Run Code Online (Sandbox Code Playgroud)
当我单击确定时,此消息出现:
文件'd:\ aaf5ce84f8decdcaf3b2f1 \ 1033_ENU_LP \ redist \ VisualStudioShell \ VSIntSetup \'不是产品的有效安装Microsoft Visual Studio 2010 Shell(集成)-ENU ...”
.net deployment windows-installer visual-studio visual-studio-2017
我正在尝试在VS和Xamarin上重建Android应用程序,但是我收到了这个错误
找不到与给定名称匹配的资源:attr'android:elevation'.
这是属性:
<item name="android:elevation">@dimen/design_bottom_sheet_modal_elevation</item>
Run Code Online (Sandbox Code Playgroud)
我使用这些值进行编译:
错误来自文件values.xml,但有时文件中的不同属性会发生同样的错误; 值-23xml或22..etc
我正在寻找一个只有当一组数据至少有一条带有State == 0另一条记录的记录时才返回true的查询State > 0
我有这个方法:
public bool HasHistory(Guid id)
{
return GetHistory(id).Any(x => x.State == 0); //&&x.State > 0 ?!
}
Run Code Online (Sandbox Code Playgroud)
我不知道如何实现这一点,因为大多数LINQ扩展方法分别迭代每个元素!
c# ×7
linq ×3
.net ×1
android ×1
angularjs ×1
asp.net ×1
asynchronous ×1
azure ×1
deployment ×1
ef-core-2.0 ×1
radio-button ×1
sql-server ×1
task ×1