如果我放置DISTINCT关键字我得到一个错误,否则它工作正常.
错误:消息145,级别15,状态1,过程SP_Products_GetList,第15行ORDER BY项目必须出现在选择列表中,如果指定了SELECT DISTINCT.
ALTER PROCEDURE [dbo].[SP_Products_GetList]
@CatID int,
@CatName int,
@IsNew bit,
@InActive bit,
@SortBy varchar(50),
@SortType varchar(50)
AS
SELECT DISTINCT Products.ProductID, ProductName, MAX(Price) Price, PriceID, [Description], Size, IsNew, InActive FROM (SELECT * FROM Products WHERE (@InActive is null or @InActive = InActive ) AND ( @IsNew is null or @IsNew = IsNew )) Products
INNER JOIN ProductCategory
on Products.ProductID = ProductCategory.ProductID
INNER JOIN (
SELECT * FROM Categories
WHERE
( @CatID is null or @CatID = CatID ) …Run Code Online (Sandbox Code Playgroud) 如何使用Google Map API访问或显示区域(纬度/经度)附近的学校/地点
项目:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
中继器控制我想将课程放在突出显示的项目编号上.
所以...我已经完成了以下代码.
if ((DL_NewProducts.Items.Count) % 3 == 0)
{
var libox = e.Item.FindControl("libox") as HtmlGenericControl;
if (libox != null)
libox.Attributes["class"] = "last";
}
Run Code Online (Sandbox Code Playgroud)
这是问题,在第一次迭代中它找到三个项目,mod工作正常,它将类放在第4项,但在第二次迭代它再次来到第6项并将类放在第7项,而我希望它将它放在第8项将是什么正确的逻辑..
我打电话的时候
Regex.Replace(
"My [Replace] text and another [Replace]",
"[Replace]",
"NewText",
RegexOptions.IgnoreCase)
Run Code Online (Sandbox Code Playgroud)
这给我以下结果我不知道为什么会给出意想不到的结果.
我的[NewTextNewTextNewTextNewTextNewTextNewTextNewText] tNewTextxt NewTextnd NewTextnothNewTextNewText [NewTextNewTextNewTextNewTextNewTextNewTextNewText]
如何更改正则表达式,因此结果可能是这样的.
我的NewText文本和另一个NewText
我有很多客户端,我想给他们脚本,所以我想根据他们的Cusotmer ID创建JS文件.所以我可以返回并直接在客户端执行.客户端可以是PHP,Html,ASP.net中的任何人
问题是,当我浏览这个链接时,它给了我JS字符串,但在客户端,这个脚本没有执行就像测试我把警报这个警报没有显示在客户端
顾客
<head>
<script src="http://localhost:12604/JSCreator/Handler.ashx?CustomerID=123" type="text/javascript"></script>
<title></title>
</head>
Run Code Online (Sandbox Code Playgroud)
处理程序文件
public class Handler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string CustomerId = context.Request["CustomerId"].ToString();
string jscontent = JSFileWriter.GetJS(CustomerId); // This function will return my custom js string
context.Response.ContentType = "text/javascript";
context.Response.Write(jscontent);
}
public bool IsReusable
{
get
{
return false;
}
}
}
Run Code Online (Sandbox Code Playgroud) 如何使用linq或lambda表达式获取开始日期和结束日期之间的日期列表.
DateTime StartDate = DateTime.Now;
DateTime EndDate = DateTime.Now.AddMonths(13);
List<DateTime> ListofDates = //Contains list of all dates only between start and end date.
Run Code Online (Sandbox Code Playgroud) 我已经托管了在ASP.net中开发的Web Api.我想如果有人调用我的API,那么我可以稍后登录数据库,如果我想使用C#拒绝来自特定id的请求.
获取消费者IP和HostName的最佳做法是什么?
public static string GetIP4Address()
{
string IP4Address = String.Empty;
foreach (IPAddress IPA in Dns.GetHostAddresses(Request.ServerVariables["REMOTE_ADDR"].ToString())))
{
if (IPA.AddressFamily.ToString() == "InterNetwork")
{
IP4Address = IPA.ToString();
break;
}
}
if (IP4Address != String.Empty)
{
return IP4Address;
}
foreach (IPAddress IPA in Dns.GetHostAddresses(Dns.GetHostName()))
{
if (IPA.AddressFamily.ToString() == "InterNetwork")
{
IP4Address = IPA.ToString();
break;
}
}
return IP4Address;
}
Run Code Online (Sandbox Code Playgroud) 我在温莎城堡注册了这个.什么是AutoFac中的替代代码?
//Transient
context.IocManager.IocContainer.Register(
Classes.FromAssembly(context.Assembly)
.IncludeNonPublicTypes()
.BasedOn<ITransientDependency>()
.WithService.Self()
.WithService.DefaultInterfaces()
.LifestyleTransient()
);
Run Code Online (Sandbox Code Playgroud) 假设我在Javascript中有变量
var currentpage = 0;
Run Code Online (Sandbox Code Playgroud)
我的地址页面地址是www.xyz.com/page/1
当我点击某处并且js函数触发时
currentpage = 1
//Here I want to change/rewrite www.xyz.com/page/2
//Without redirecting to this page
Run Code Online (Sandbox Code Playgroud) c# ×5
javascript ×2
sql-server ×2
t-sql ×2
.net ×1
asp.net ×1
autofac ×1
distinct ×1
google-maps ×1
lambda ×1
linq ×1
logic ×1
regex ×1
sql ×1
sql-order-by ×1