同時插入多筆資料不能寫在同一句 query內
ex:
INSERT INTO [table]
([field1], [field2], [field3])
VALUES
(@fieldA1, @fieldA2, @fieldA3), (@fieldB1, @fieldB2, @fieldB3)
INSERT INTO [table]
([field1], [field2], [field3])
VALUES
(@fieldA1, @fieldA2, @fieldA3), (@fieldB1, @fieldB2, @fieldB3)
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="Pages_test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script type="text/javascript" src="<%=Page.ResolveUrl("~/") %>js/jquery-1.8.3.min.js"></script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<img id="img1" src="<%=Page.ResolveUrl("~/") %>images/ajax-loader.gif" /><input id="btn1" type="button" value="Click" /><br />
<img id="img2" src="<%=Page.ResolveUrl("~/") %>images/ajax-loader.gif" /><input id="btn2" type="button" value="Click" /><br />
<img id="img3" src="<%=Page.ResolveUrl("~/") %>images/ajax-loader.gif" /><input id="btn3" type="button" value="Click" /><br />
</div>
</form>
</body>
</html>
$(function () {
$('img').hide();
$('img').hide();
$('#btn1').click(function () {
$('#img1').show();
$.ajax({
url: "/mjib/Services/CaseManageServices.ashx",
type: 'POST',
cache: false,
data: {
OperationType: 'test'
},
success: function (response) {
$('#img1').hide();
},
error: function (response) {
$('#img1').hide();
}
});
});
$('#btn2').click(function () {
$('#img2').show();
$.ajax({
url: "/mjib/Services/CaseManageServices.ashx",
type: 'POST',
cache: false,
data: {
OperationType: 'test'
},
success: function (response) {
$('#img2').hide();
},
error: function (response) {
$('#img2').hide();
}
});
});
$('#btn3').click(function () {
$('#img3').show();
$.ajax({
url: "/mjib/Services/CaseManageServices.ashx",
type: 'POST',
cache: false,
data: {
OperationType: 'test'
},
success: function (response) {
$('#img3').hide();
},
error: function (response) {
$('#img3').hide();
}
});
});
});
</script>
using (SqlConnection Bulkconn = new SqlConnection(conn.ConnectionString))
{
Bulkconn.Open();
using (SqlBulkCopy sqlBC = new SqlBulkCopy(Bulkconn))
{
sqlBC.DestinationTableName = "dbo." + dt.TableName;
foreach (DataColumn dc in dt.Columns)
{
sqlBC.ColumnMappings.Add(dc.ColumnName, dc.ColumnName);
}
sqlBC.WriteToServer(dt);
}
}
<div id="divAddFolder" class="hideUC">
<table>
<tr>
<td>
資料夾名稱
</td>
<td>
<input id="txtNewNodeName" type="text" />
</td>
</tr>
</table>
<input id="btnAddNode" type="button" value="確定" />
<input id="btnCancelAddNode" type="button" value="取消" />
</div>
function PopupboxAdd() {
$.blockUI({
message: $('#divAddFolder'),
css: {
top: ($(window).height() - 300) / 2 + 'px',
left: ($(window).width() - 300) / 2 + 'px',
width: '300px'
}
});
}
scuess(response):{
var result = eval(response); // trans text to json
}
$.ajax({
url: '/usercontrols/ExportHighchartPhotoServices.ashx',
type: 'POST',
async: false,
data: { ... },
error: function (xhr, ajaxOptions, thrownError) {
...
},
success: function (response) {
...
}
});
ExcelWorksheet Worksheet = Package.Workbook.Worksheets.Add(dt.TableName.Replace("?", ""));
"Hello".replace(/ll/g,"qq");
var reg = new RegExp(billNumber + ',', 'g');
$("#number").html($("#number").html().replace(reg, ''));
padding:10px;
padding:9px\9; /* all ie */
padding:8px\0; /* ie8-9 */
*padding:5px; /* ie6-7 */
+padding:7px; /* ie7 */
_padding:6px; /* ie6 */
////合併上下欄位(colIdx)
jQuery.fn.rowspan = function(colIdx) {
return this.each(function() {
var that;
$('tr', this).each(function(row) {
var thisRow = $('td:eq(' + colIdx + '),th:eq(' + colIdx + ')', this);
if ((that != null) && ($(thisRow).html() == $(that).html())) {
rowspan = $(that).attr("rowSpan");
if (rowspan == undefined) {
$(that).attr("rowSpan", 1);
rowspan = $(that).attr("rowSpan");
}
rowspan = Number(rowspan) + 1;
$(that).attr("rowSpan", rowspan);
$(thisRow).remove(); ////$(thisRow).hide();
} else {
that = thisRow;
}
that = (that == null) ? thisRow : that;
});
alert('1');
});
}
////當指定欄位(colDepend)值相同時,才合併欄位(colIdx)
jQuery.fn.rowspan = function(colIdx, colDepend) {
return this.each(function() {
var that;
var depend;
$('tr', this).each(function(row) {
var thisRow = $('td:eq(' + colIdx + '),th:eq(' + colIdx + ')', this);
var dependCol = $('td:eq(' + colDepend + '),th:eq(' + colDepend + ')', this);
if ((that != null) && (depend != null) && ($(thisRow).html() == $(that).html()) && ($(depend).html() == $(dependCol).html())) {
rowspan = $(that).attr("rowSpan");
if (rowspan == undefined) {
$(that).attr("rowSpan", 1);
rowspan = $(that).attr("rowSpan");
}
rowspan = Number(rowspan) + 1;
$(that).attr("rowSpan", rowspan);
$(thisRow).remove(); ////$(thisRow).hide();
} else {
that = thisRow;
depend = dependCol;
}
that = (that == null) ? thisRow : that;
depend = (depend == null) ? dependCol : depend;
});
});
}
////合併左右欄位
jQuery.fn.colspan = function(rowIdx) {
return this.each(function() {
var that;
$('tr', this).filter(":eq(" + rowIdx + ")").each(function(row) {
$(this).find('th,td').each(function(col) {
if ((that != null) && ($(this).html() == $(that).html())) {
colspan = $(that).attr("colSpan");
if (colspan == undefined) {
$(that).attr("colSpan", 1);
colspan = $(that).attr("colSpan");
}
colspan = Number(colspan) + 1;
$(that).attr("colSpan", colspan);
$(this).remove();
} else {
that = this;
}
that = (that == null) ? this : that;
});
});
});
}
<script type="text/javascript">
$(function () {
//模擬顯示資料
var data =
[
{ No: "1", Name: "Jeffrey", Date: "2011/05/07", Score: 2011 },
{ No: "1", Name: "Jeffrey", Date: "2011/06/21", Score: 9999 },
{ No: "1", Name: "Jeffrey", Date: "2011/06/22", Score: 32767 },
{ No: "2", Name: "Mulder", Date: "2011/06/01", Score: 999 },
{ No: "3", Name: "Darkthread", Date: "2011/06/10", Score: 100 },
{ No: "3", Name: "Darkthread", Date: "2011/06/15", Score: 100 }
];
var h = [];
for (var i = 0; i < data.length; i++) {
h.push("<tr>");
var obj = data[i];
for (var p in obj)
h.push("<td class='c-" + p + "'>" + obj[p] + "</td>");
h.push("</tr>");
}
$("#scoreboard tbody").html(h.join('\n'));
//合併內容相同欄位的邏輯
$("#btnShowMe").click(function () {
var $lastCell = null;
var mergeCellSelector = ".c-No,.c-Name";
$("#scoreboard tbody td.c-No").each(function () {
//跟上列的td.c-No比較,是否相同
if ($lastCell && $lastCell.text() == $(this).text()) {
//取得上一列,將要合併欄位的rowspan + 1
$lastCell.closest("tr").children(mergeCellSelector)
.each(function () {
this.rowSpan = (this.rowSpan || 1) + 1;
});
//將本列被合併的欄位移除
$(this).closest("tr").children(mergeCellSelector).remove();
}
else //若未發生合併,以目前的欄位作為上一欄位
$lastCell = $(this);
});
});
});
</script>
<table id="scoreboard">
<thead>
<tr><td>No</td><td>Name</td><td>Date</td><td>Score</td></tr>
</thead>
<tbody>
</tbody>
</table>
void gv_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[0].CssClass="SubProjectTd";
// 在每一個 row的第一個 column加上 class
}
}
$("#ddlSurvey").attr("multiple", "multiple");
$("#ddlSurvey").multiselect({...});
$("#ddlSurvey").multiselect('refresh');
System.IO.StreamReader file = new System.IO.StreamReader(filePath);
string articleString = file.ReadToEnd();
new System.IO.StreamReader(filePath, Encoding.Default);
default預設用 ANSI解碼
$.ajax({
type: "POST",
url: "../../WebService.asmx/FindPerson",
data: params, // 參數
contentType: "application/json; charset=utf-8", // 參數格式
dataType: "json", // 回傳格式
success: function(response) {
// 將 WEB SERVICE 回傳的字串轉為物件
var jsonObj = $.parseJSON(response.d);
// 使用 chrome 按 F12 選擇 console 即可看到結果
console.log("Hello, I am " + jsonObj.name);
}
,failure: function(msg) { }
,error: function(msg) { }
});
BasePage.Current.ClientScript.RegisterStartupScript(</pre>
this.GetType(),
"resetActiveTab",
"<script language=\"javascript\" type=\"text/javascript\">
jQuery(document).ready(function(){;
alert(\"xxx\")
}
);
</script>"
this.Page.ClientScript.RegisterStartupScript(...);
result = ($(this).html()=="SubProject");
result: falseresult = ($(this).html().trim()=="SubProject");
result: true
string connectionString = "Data Source=xxx;Initial Catalog=yyy;Integrated Security=True;Application Name=zzz"
string command = "SELECT ... FROM ... WHERE ... ";
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
SqlCommand command = new SqlCommand(sqlInsertCommand, connection);
command.Parameters.Clear();
command.Parameters.AddWithValue("@Id", Id);
command.ExecuteNonQuery();
command.Cancel();
}
_logGuid = Guid.NewGuid()
string connectionString = "data source=id;initial catalog=table;integrated security=true;";
Page_Load(object sender, EventArgs e) {
if (Page.IsPostBack) {
/* step 1 */
}
else {
/* step 4 */
}
/* step 5 */
...
/* step 2 6 */
}
aspResultPager_Init(object sender, EventArgs e) {
/* step 3 */
}
if (_customizeQuery.Contains(" "))
{
string[] splitString = _customizeQuery.Split(' ');
_query.QueryString
= string.Format("and({0})", string.Join(",", splitString));
}
_searchView = _searchFactory.GetSearchView(config.collection);
_searchResult = _searchView.Search(_query);
string[] strArray = new string[] { "EAD69342-F06D-4253-83AC-28000225583B", "158AA029-24ED-4948-939E-C3DA209E5FBA", "C2D6894B-E788-4425-BCF2-308568E3D38B" };<
<style type="text/css">
.slide-prev, .slide-next {
position:absolute;
background-image: url(/media/assets/apt/arrow.png);
background-repeat: no-repeat;
background-position: 0 0;
display: block;
height: 45px;
width: 27px;
padding: 0px 10px;
z-index:9999;
opacity:0.7;
cursor:pointer;
}
.slide-next {
background-position: 0 -46px;
}
</style>
$(function () {
$("#aspQueryString").keyup(function () {
if ($(this).attr("value").length > 100) {
}
});
});
trendmicro.safeqa.BetaPortalUrls4FAST _result = new trendmicro.safeqa.BetaPortalUrls4FAST();<
using presentation.nodeFactory; using umbraco.NodeFactory;
型別 'umbraco.interfaces.INode' 是定義在未參考的組件中。您必須加入參考至組件 'interfaces, Version=1.0.4085.20549, Culture=neutral, PublicKeyToken=null'
$("<option>").text(xxx.val(xxx));
("area").hover(
function () {
clearInterval(change_Interval);
},
function () {
change_Interval = setInterval (changeIMG, 5000);
}
);
function Action(){ ... };
var interval = setInterval(Action, 5000);
clearInterval(interval);
$("div#postlist > div:eq(1)").hide();
$("div#postlist > div:gt(3)").hide();
lt 所有小於指定 index的元素
var now = $("#list1 option:selected").val();
var pos = $("#list1")[0].selectedIndex;
$.each(arr, function (ind, text) {
$("[id=list" + index + "]")
.append($("")
.attr("value", text)
.text(text));
});
$("[name=FromStation]").append(
$("<option></option>").attr("value", 0).text("請選擇"));
$("#FromCity").attr('disabled', 'disabled');
$("#FromStation").removeAttr('disabled');
groupName == "ansvalue"
↓↓↓
groupName.Equals("ansvalue", StringComparison.CurrentCultureIgnoreCase)
string strValue = "(@AnalysisVarID,@AnalysisGroupID,@GroupCode{0},@GroupValue{0})";
...
DbCommand cmd = db.GetSqlStringCommand("INSERT INTO AnalysisGroupCode Values" + string.Join(",", lstValue.ToArray()) +";");
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
{
...
}
using (IDataReader reader = db.ExecuteReader(cmd))
{
if(...)
{
admin.ID = (reader.IsDBNull(0) ? 0 : reader.GetInt32(0));
...
}
}
- 靜態內容(Static Content)
- 預設文件(Default Document)
- 瀏覽目錄(Directory Browsing)
- HTTP錯誤(HTTP Errors)
- HTTP記錄(HTTP Logging)
- 記錄工具(Logging Tools)
- 要求監視器(Request Monitor)
- 要求篩選(Request Filtering)
- 靜態內容壓縮(Static Content Compression)
- IIS管理主控台(IIS Management Console)
- ASP(ASP)
- 要求篩選(Request Filtering)
- ISAPI擴充功能(ISAPI Extensions)
- ASP.NET(ASP.NET)
- .NET擴充性(NetFxExtensibility)
- 要求篩選(Request Filtering)
- ISAPI(ISAPI)
- ISAPI 擴充程式(ISAPI Extensions)
string selectCommand =
@"SELECT UserName FROM UserAccount WHERE UserID='" + Request("UID") + "' AND UserPWD='" + Request("PWD") + "'";
SELECT UserName FROM UserAccount WHERE UserID='' or 1=1 -- ' AND UserPWD=''";
就可以直接登入SELECT UserName FROM UserAccount WHERE UserID='admin'-- ' AND UserPWD=''";
<location path="servicestack"> <system.web> <httpHandlers> <add path="*" type="ServiceStack.WebHost.Endpoints. ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/> </httpHandlers> </system.web> <!-- Required for IIS 7.0 --> <system.webServer> <handlers> <add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints. ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" /> </handlers> </system.webServer> </location>希望沒有 Web Framework (host web services at :/custompath)
<location path="servicestack"> <system.web> <httpHandlers> <add path="*" type="ServiceStack.WebHost.Endpoints. ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/> </httpHandlers> </system.web> <!-- Required for IIS 7.0 --> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> <validation validateIntegratedModeConfiguration="false" /> <handlers> <add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints. ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" /> </handlers> </system.webServer> </location>
<form action="servicestack/xml/syncreply/Hello" method="post"> <label>Name:</label> <input type="text" name="Name" value="World!"> <input type="submit"> </form>
......待續