我正在尝试通过 sql proc 使用搜索,但每次出现未完成代码的错误时我都不知道该怎么办
I am trying to use the search through sql proc and every time I get an error for not completing the code and I don’t know what to do
iam尝试使用sqlproc获取数据,我尝试执行代码,但是每次都没有创建代码,我不知道原因
这是我的 classes
public class CLS_ShowModels
{
public int ID { get; set; }
public string Cid { get; set; }
public string Sid { get; set; }
public string ModelCode { get; set; }
public string ModelName { get; set; }
public string FloorID { get; set; }
public string PathroomTypeID { get; set; }
public string PathroomNameID { get; set; }
public string Size { get; set; }
public string DateShow { get; set; }
public string Descreption { get; set; }
public string StoreLocation { get; set; }
public string ImageURL { get; set; }
public string Image360URL { get; set; }
}
此命令class
public CLS_ShowModels GetCategoryId(string name)
{
try
{
return cmd.GetSingle("SF_SearchPathroom @ModelName",
new
{
ModelName =name
});
}
catch (Exception)
{
return null;
}
}
public List<CLS_ShowModels> GetAllShowRoom()
{
try
{
return cmd.GetAll("SF_SearchPathroom").ToList();
}
catch (Exception)
{
return null;
}
}
这是查看代码,你能帮我完成这个任务吗
@using (@Html.BeginForm())
{
<table>
<tr>
<td>
<div class="input-group">
<input type="text" name="modelname" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<button type="submit" name="search" id="search-btn" class="btn btn-flat">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</td>
</tr>
</table>
}
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/aframe/1.0.4/aframe.min.js"></script>
@foreach (var item in Model)
{
<div class="col-md-3" style="margin-bottom:20px">
<div class="thumbnail">
<div class="img-responsive" style="margin-bottom:20px">
<img src="@Url.Content(item.ImageURL)" target="_blank" style="background-size:cover" height="240" width="240" />
</div>
<div class="caption" style="border-top:3px solid #808080">
@using (Html.BeginForm("Showpanorama", "PathroomShow", FormMethod.Post, new { target = "_blank" }))
{
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td></td>
<td>
<h4 style="color:blueviolet;font:bolder"><input name="Name" hidden="hidden" type="text" value="@item.Image360URL" /></h4>
</td>
</tr>
<tr>
<td></td>
<td>
<input class="btn btn-info" type="submit" value="Panorama 360°" />
</td>
</tr>
</table>
}
@using (Html.BeginForm("ShowRoom", "PathroomShow", FormMethod.Post, new { target = "_blank" }))
{
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td></td>
<td>
<h4 style="color:blueviolet;font:bolder"><input name="Name" hidden="hidden" type="text" value="@item.ImageURL" /></h4>
<h4 style="color:blueviolet;font:bolder"><input name="Name1" hidden="hidden" type="text" value="@item.ModelName" /></h4>
<h4 style="color:blueviolet;font:bolder"><input name="Name2" hidden="hidden" type="text" value="@item.Sid" /></h4>
<h4 style="color:blueviolet;font:bolder"><input name="Name3" hidden="hidden" type="text" value="@item.Size" /></h4>
</td>
</tr>
<tr>
<td></td>
<td>
<input class="btn btn-info" type="submit" value="Show Room" />
</td>
</tr>
</table>
}
<h4 style="color:blueviolet;font:bolder"><a href="@Url.Content(item.ImageURL)" onclick="cataloge" target="_blank">@item.ModelName</a></h4>
<h5 style="color:darkslateblue;font:bolder"> Model : @item.Sid</h5>
<h5 style="color:blue;font:bolder">Size : @item.Size</h5>
<h5 style="color:red;font:bolder">Date : @item.DateShow</h5>
</div>
</div>
</div>
}
这是功能控制器
CLS_ShowModels Productdb = new CLS_ShowModels();
cmdShowRoom showRppmcmd = new cmdShowRoom();
public ActionResult Search(string search)
{
CLS_ShowModels Productdb = new CLS_ShowModels();
cmdShowRoom showRppmcmd = new cmdShowRoom();
return View((showRppmcmd.GetCategoryId.Where(x => x.ModelName.Contains(search) ).ToList());
}
代码有什么错误showRppmcmd.GetCategoryId.Where
showRppmcmd.GetCategoryId
的代码是什么?如果是这样的方法:
public xxx GetCategoryId(){
....
}
您需要使用 showRppmcmd.GetCategoryId()
。
如果这样的方法:
public xxx GetCategoryId(xxx xxxxx){
....
}
您需要使用 showRppmcmd.GetCategoryId(xxxxx)
.
并且您不能在 Where.You 中使用 .ToList()
最好显示 cmdShowRoom
的 GetCategoryId
。
iam尝试使用sqlproc获取数据,我尝试执行代码,但是每次都没有创建代码,我不知道原因 这是我的 classes
public class CLS_ShowModels
{
public int ID { get; set; }
public string Cid { get; set; }
public string Sid { get; set; }
public string ModelCode { get; set; }
public string ModelName { get; set; }
public string FloorID { get; set; }
public string PathroomTypeID { get; set; }
public string PathroomNameID { get; set; }
public string Size { get; set; }
public string DateShow { get; set; }
public string Descreption { get; set; }
public string StoreLocation { get; set; }
public string ImageURL { get; set; }
public string Image360URL { get; set; }
}
此命令class
public CLS_ShowModels GetCategoryId(string name)
{
try
{
return cmd.GetSingle("SF_SearchPathroom @ModelName",
new
{
ModelName =name
});
}
catch (Exception)
{
return null;
}
}
public List<CLS_ShowModels> GetAllShowRoom()
{
try
{
return cmd.GetAll("SF_SearchPathroom").ToList();
}
catch (Exception)
{
return null;
}
}
这是查看代码,你能帮我完成这个任务吗
@using (@Html.BeginForm())
{
<table>
<tr>
<td>
<div class="input-group">
<input type="text" name="modelname" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<button type="submit" name="search" id="search-btn" class="btn btn-flat">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</td>
</tr>
</table>
}
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/aframe/1.0.4/aframe.min.js"></script>
@foreach (var item in Model)
{
<div class="col-md-3" style="margin-bottom:20px">
<div class="thumbnail">
<div class="img-responsive" style="margin-bottom:20px">
<img src="@Url.Content(item.ImageURL)" target="_blank" style="background-size:cover" height="240" width="240" />
</div>
<div class="caption" style="border-top:3px solid #808080">
@using (Html.BeginForm("Showpanorama", "PathroomShow", FormMethod.Post, new { target = "_blank" }))
{
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td></td>
<td>
<h4 style="color:blueviolet;font:bolder"><input name="Name" hidden="hidden" type="text" value="@item.Image360URL" /></h4>
</td>
</tr>
<tr>
<td></td>
<td>
<input class="btn btn-info" type="submit" value="Panorama 360°" />
</td>
</tr>
</table>
}
@using (Html.BeginForm("ShowRoom", "PathroomShow", FormMethod.Post, new { target = "_blank" }))
{
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td></td>
<td>
<h4 style="color:blueviolet;font:bolder"><input name="Name" hidden="hidden" type="text" value="@item.ImageURL" /></h4>
<h4 style="color:blueviolet;font:bolder"><input name="Name1" hidden="hidden" type="text" value="@item.ModelName" /></h4>
<h4 style="color:blueviolet;font:bolder"><input name="Name2" hidden="hidden" type="text" value="@item.Sid" /></h4>
<h4 style="color:blueviolet;font:bolder"><input name="Name3" hidden="hidden" type="text" value="@item.Size" /></h4>
</td>
</tr>
<tr>
<td></td>
<td>
<input class="btn btn-info" type="submit" value="Show Room" />
</td>
</tr>
</table>
}
<h4 style="color:blueviolet;font:bolder"><a href="@Url.Content(item.ImageURL)" onclick="cataloge" target="_blank">@item.ModelName</a></h4>
<h5 style="color:darkslateblue;font:bolder"> Model : @item.Sid</h5>
<h5 style="color:blue;font:bolder">Size : @item.Size</h5>
<h5 style="color:red;font:bolder">Date : @item.DateShow</h5>
</div>
</div>
</div>
}
这是功能控制器
CLS_ShowModels Productdb = new CLS_ShowModels();
cmdShowRoom showRppmcmd = new cmdShowRoom();
public ActionResult Search(string search)
{
CLS_ShowModels Productdb = new CLS_ShowModels();
cmdShowRoom showRppmcmd = new cmdShowRoom();
return View((showRppmcmd.GetCategoryId.Where(x => x.ModelName.Contains(search) ).ToList());
}
代码有什么错误showRppmcmd.GetCategoryId.Where
showRppmcmd.GetCategoryId
的代码是什么?如果是这样的方法:
public xxx GetCategoryId(){
....
}
您需要使用 showRppmcmd.GetCategoryId()
。
如果这样的方法:
public xxx GetCategoryId(xxx xxxxx){
....
}
您需要使用 showRppmcmd.GetCategoryId(xxxxx)
.
并且您不能在 Where.You 中使用 .ToList()
最好显示 cmdShowRoom
的 GetCategoryId
。