我有一个快速的 SQL 问题。在我的 MVC Razor 应用程序中,我有两个文本输入要求输入开始值和结束值。
这些值将是数字,它们对应于版本 Ex:4.0.100 - 4.0.157
所以我需要显示 100 - 157 之间的所有版本我可以直接访问他的数据库,它是版本列
我的问题是:我如何编写或获取查询以显示此内容?
模型:
using System;
using System.Collections.Generic;
namespace BenchmarkApp.Models
{
public partial class Build
{
public Build()
{
this.Executions = new List<Execution>();
}
public string Version { get; set; }
public bool Obfuscated { get; set; }
public bool Release { get; set; }
public int ID { get; set; }
public bool IsX64 { get; set; }
public bool Visible { get; set; }
public Nullable<System.DateTime> CreationDate { get; set; }
public virtual ICollection<Execution> Executions { get; set; }
}
}
显示两个输入的 .cshtml 视图:
<td>
Viewing Option: @Html.DropDownList("ViewOption", (IEnumerable<SelectListItem>)ViewBag.ViewSelect, new { @onchange = "submit()" })
</td>
<td>
@if (ViewBag.RangeVisible == true)
{
@Html.Label("Range: ");
@Html.TextBox("start", "Start", new { maxlength = 10, size = 10 });
@Html.TextBox("end", "End", new { maxlength = 10, size = 10, @onchange = "submit()" });
}
我访问文本输入的控制器类:
string start = form["start"];
string end = form["end"];
string custom = form["customRange"];
string viewSelect = form["ViewOption"];
if (viewSelect.Equals("range"))
{
ViewBag.RangeVisible = true;
}
先感谢您!