小编Neg*_*gar的帖子

我该如何转换小数?到十进制

可能是一个简单的问题,但我尝试了所有的转换方法!它仍然有错误!你能帮我吗?

十进制?(可以为十进制)到十进制

.net c# nullable decimal type-conversion

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

System.ServiceModel.Activation.HttpModule错误

下面这行错误的原因是什么?

<system.web>
    <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="fa-IR" uiCulture="fa-IR" />
    <compilation targetFramework="4.0" debug="true">
      <assemblies> <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral,  PublicKeyToken=b77a5c561934e089" />
Run Code Online (Sandbox Code Playgroud)

iis-7 .net-4.0

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

使用Request.Files [“ files”] MVC上传多个文件

这是我的代码。我想将3个文件上传到我的数据库中

首先在View中,我这样写:<%using(Html.BeginForm(Actionname,Controller,FormMethod.Post,new {enctype =“ multipart / form-data”})){%> ..... ....

这是3个文件更新:

<input type="file" name="files" id="FileUpload1" />
<input type="file" name="files" id="FileUpload2" />
<input type="file" name="files" id="FileUpload3" />
Run Code Online (Sandbox Code Playgroud)

在控制器中,我使用以下代码:

IEnumerable<HttpPostedFileBase> files = Request.Files["files"] as IEnumerable<HttpPostedFileBase>;
foreach (var file in files)
{
byte[] binaryData = null;
HttpPostedFileBase uploadedFile = file;
if (uploadedFile != null && uploadedFile.ContentLength > 0){
 binaryData = new byte[uploadedFile.ContentLength];
 uploadedFile.InputStream.Read(binaryData, 0,uploadedFile.ContentLength);
}
}
Run Code Online (Sandbox Code Playgroud)

但是文件总是返回NULL :(

请帮助我,谢谢。

asp.net-mvc-2

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

我该如何使用FirstOrDefault()?

我有这个代码,我想在表达式没有返回数据时为Viewdate设置一个值:

ViewData["Fix"] = db.PreStatusViws.Where(c => c.LkpNameFix == "1").FirstOrDefault().NumCoefficientFix;
Run Code Online (Sandbox Code Playgroud)

我可以为此设置零或"文本"吗?我不,我该怎么办?!注意:FirstOrDefault(null)导致错误.

linq asp.net-mvc

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