小编Sid*_*med的帖子

在存储过程中构建动态WHERE子句

我正在使用SQL Server 2008 Express,并且我有一个SELECT基于参数从表中执行的存储过程.我有nvarchar参数和int参数.

这是我的问题,我的where子句看起来像这样:

WHERE [companies_SimpleList].[Description] Like @What 
    AND companies_SimpleList.Keywords Like @Keywords
    AND companies_SimpleList.FullAdress Like @Where
    AND companies_SimpleList.ActivityId = @ActivityId
    AND companies_SimpleList.DepartementId = @DepartementId
    AND companies_SimpleList.CityId = @CityId
Run Code Online (Sandbox Code Playgroud)

此参数是由我的ASP.NET MVC 3应用程序的用户设置的过滤器值,并且int参数不能设置,所以其价值将是0.这是我的问题,存储过程将搜索谁拥有的项目0CityId为例如,为此,它返回错误的结果.因此,如果int参数的值大于0,那么能够拥有动态where子句会很好.

提前致谢

sql sql-server stored-procedures sql-server-2008

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

css内联块和引导网格系统输出

我正在尝试HTML使用css和我的div 的特定标记bootstrap 3.2.下图显示了我想要的结果.

我使用了引导网格系统,以便我的页面能够响应并在小屏幕设备中正确显示.这是我试过的代码.我用http://www.bootply.com来测试它.

任何想法如何获得标记?

<div>
  <div style="display:inline-block; border:1px solid gray; width:150px; height:150px;">
    <img src='' alt="image go here !"/>
  </div>

  <div class="container-fluid" style="display:inline-block;">
    <div class="row" style="border:1px solid gray;">
      <div class="col-md-9">This is the product name</div>
      <div class="col-md-3 text-right">1 230.99</div>
    </div>

    <div class="row" style="display:inline-block; border:1px solid gray;">
      <div class="col-md-6">Property 1</div>
      <div class="col-md-6">Property 2</div>
    </div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

期望的结果: 期望的结果

编辑:我得到的结果: 结果我得到了

html css twitter-bootstrap twitter-bootstrap-3

6
推荐指数
1
解决办法
4万
查看次数

使用$ .ajax获取局部视图

我正在使用ASP.NET MVC 3来构建一个应用程序,但是在尝试获取局部视图时遇到了问题.这是我的代码

风景 :

@{while (Model.Read())
{
    <ul class="tabs">
        <li id="general" class="active">Informations générals</li>
        <li id="contact">Contacts</li>
    </ul>

    <div id="contentDetail">
        <div><b>Description :</b> @Model["Description"]</div>
        <div><b>Activity :</b> @Model["Activity"]</div>
    </div>

    <script type="text/javascript">

        $("#contact").click(function () {
            $.ajax({
                url: '@Url.Content("~/Company/Contacts/")',
                type: 'get',
                data: JSON.stringify('@Model["Id"]'),
                datatype: 'json',
                contentType: 'application/json; charset=utf-8',
                success: function (data) {
                    $('#contentDetail').replaceWith(data);
                    },
                error: function (request, status, err) {
                    alert(status);
                    alert(err);
                    }
            });
        });
    </script>
}
Run Code Online (Sandbox Code Playgroud)

}

控制器:

public ActionResult Contacts(int id)
    {
        return PartialView("_Contacts", getContactDetails(id));
    }
Run Code Online (Sandbox Code Playgroud)

"_Contacts"是我的部分视图,它是强类型的.

家我很清楚,谢谢^^

jquery partial-views asp.net-mvc-3

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

devexpress gridView.Rows?

我想用Devexpress扩展(gridview)做到这一点:

string dataInCell = dataGridView1.Rows[i].Cells[j].Value.ToString();
Run Code Online (Sandbox Code Playgroud)

喜欢 :

gridView1.Rows[i].Cells[j]
Run Code Online (Sandbox Code Playgroud)

c# gridview devexpress datagridview gridcontrol

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

XtraReport:无法使用分配给 DataSource 属性的对象

我有一个 C# 应用程序,它使用存储在数据库中的报告,对于使用 XPObject 作为数据源(CptOperation 类,代码如下)的特定报告,我在尝试打印或预览时收到此错误消息:

分配给 DataSource 属性的对象不能用作报表的数据源,因为它没有实现任何受支持的接口。有关更多信息,请参阅 http://help.devexpress.com/#XtraReports/CustomDocument1179

这是我用来打印报告的代码。

public static void PrintReport(string reportCode, object dataSource, string printerName)
{
    using (var uow = new UnitOfWork { ConnectionString = Content.GlobalInfo.ServerConnectionString })
    {
        var report = uow.FindObject<Content.Report>(new BinaryOperator("Code", reportCode));
        if (report == null)
        {
            XtraMessageBox.Show(String.Format("The report {0} is not found", reportCode),
                Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            return;
        }

        var xtraReport = getXtraReportFromReport(report);
        xtraReport.DataSource = dataSource;

        if (!String.IsNullOrEmpty(printerName))
            xtraReport.Print(printerName);
        else
            xtraReport.Print();
    }
}

private static XtraReport getXtraReportFromReport(Content.Report report)
{
    XtraReport xtraReport; …
Run Code Online (Sandbox Code Playgroud)

.net c# devexpress datasource xtrareport

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