1、JS中使用c#变量 @+变量名
js中变量转换 转为int型:Number(变量名),转为字符串:String("变量名")
2、js弹出窗口传值
父页面:var reValue = window.showModalDialog('TotalProgess?id='+subStr, obj, 'dialogWidth=400px;dialogHeight=200px;');
父页面使用值:reValue[0],reValue[1] .....
子页面:
var arr = new Array();
arr[0] = _ProcessDescript;
arr[1] = _ProduceDescript;
arr[2] = _DeliverDt;
arr[3] = _Remark;
window.returnValue = arr;
3、SQL拼接字符串:
select ApproveDt=case when ApproveDt
from tablename
4、ViewData传递datatable
控制器代码:
List
lisdt.Add(dt);
lisdt.Add(dt2);
ViewData["lis"] = lisdt;
视图代码:
@using System.Web;
@model System.Data.DataTable
@using System.Data;
@{List
}
视图跳转页面传递datatable
5、SQL合并行
ALTER FUNCTION [dbo].[GetProcessByOrder]
(
@OrderNo varchar(30)
)
RETURNS [nvarchar](4000)
AS
BEGIN
DECLARE @ReturnValue [nvarchar](4000)
SET @ReturnValue = ''
SELECT @ReturnValue=@ReturnValue + RTRIM(LTRIM(state)) + ','
FROM TableName
WHERE OrderNO = @OrderNo
SET @ReturnValue = substring(@ReturnValue,1,len(@ReturnValue)-1)
RETURN @ReturnValue
END
GO