假设我有一个存储过程,它有一个简单的IF块.如果执行的检查符合标准,那么我想停止进一步执行该过程.
做这个的最好方式是什么?
这是代码:
IF EXISTS (<Preform your Check>)
BEGIN
// NEED TO STOP STORED PROCEDURE EXECUTION
END
ELSE
BEGIN
INSERT ()...
END
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助!
我有一个DataTable.我想获取每行第一列值并附加到字符串数组.我不想为每一行使用foreach循环并添加到字符串数组.我试过这个,但在某个时候停留了
DataRow[] dr = new DataRow[dtCampaignSubscriberLists.Rows.Count];
dtCampaignSubscriberLists.Rows.CopyTo(dr, 0);
string[] array = Array.ConvertAll(dr, new Converter<DataRow, String>(????));
Run Code Online (Sandbox Code Playgroud)
谢谢
当我编写下面的代码时,为什么我得到可用的线程编号,如1022,1020.我必须得到25个线程最大,因为我使用线程池.
我猜输出线程号是系统上的可用线程.我需要在win表单应用程序中的线程池中获取可用的线程号.
private void Foo()
{
int intAvailableThreads, intAvailableIoAsynThreds;
// ask the number of avaialbe threads on the pool,
//we really only care about the first parameter.
ThreadPool.GetAvailableThreads(out intAvailableThreads,
out intAvailableIoAsynThreds);
// build a message to log
string strMessage =
String.Format(@"Is Thread Pool: {1},
Thread Id: {2} Free Threads {3}",
Thread.CurrentThread.IsThreadPoolThread.ToString(),
Thread.CurrentThread.GetHashCode(),
intAvailableThreads);
// check if the thread is on the thread pool.
Trace.WriteLine(strMessage);
// create a delay...
Thread.Sleep(30000);
return;
}
Run Code Online (Sandbox Code Playgroud)
非常感谢..
(注意:我从http://www.codeproject.com/KB/cs/AsyncMethodInvocation.aspx获得了代码)很好的文章!!
我开始在项目中使用angularjs.在这里,我有一个任务.我有以下HTML
<div>
<label for="lastname">Bank Name :</label>
<select ui-select2 ng-model="bank.id">
<option></option>
<option ng-repeat="bank in banks" value="{{bank.id}}">{{bank.text}}</option>
</select>
</div>
Run Code Online (Sandbox Code Playgroud)
我将所有银行迭代到下拉列表.用户选择并按SAVE.我正确地得到了id并将其保存到DB中.当用户回来时,我无法将下拉值设置为他选择的值.我在controller.js中这样做
$http.get('/AdServerLongTail/api/user').
success(function(data, status, headers, config) {
if(status == 200){
$scope.id = (data["id"]);// user id
$scope.bank.id = (data["bankId"]);
}
}).
error(function(data, status, headers, config) {
alert("fail");
});
Run Code Online (Sandbox Code Playgroud)
如何将它设置为bankID 11 letssay,即XX Bank?
我有一个bool变量和一个Dictionary.如果确实如此,我必须在指定的密钥处将字典的值增加1.
我的代码:
private void Process(Person person)
{
isSendMailSuccessful = true;
if (isSendMailSuccessful)
{
MyDictionary.Where(i => i.Key == person.personID);
// I need to increase Value of that ID by 1
}
}
Run Code Online (Sandbox Code Playgroud) 我有以下数据的服务结果.它肯定会扩大.我使用谷歌图表来显示这些数据.但我现在做的是静态的.有没有一种简单的方法可以轻松地将来自服务的数据串转换为json格式.我不想使用foreach循环为谷歌图表数据生成该字符串.我也在我的项目中使用angularjs.感谢任何帮助
[
{
"date": "2013-05-01",
"amount": null,
"imprCount": 120,
"clickCount": 141
},
{
"date": "2013-05-02",
"amount": null,
"imprCount": 1122,
"clickCount": 125
},
{
"date": "2013-05-03",
"amount": null,
"imprCount": 1782,
"clickCount": 1154
}
]
//Chart Data
chartIncome.data = {"cols": [
{/*id: "month",*/ label: "Month", type: "string"},
{/*id: "income-id",*/ label: "Income", type: "number"}
], "rows": [
{c: [
{v: "2013-05-01"},
{v: 12}
]},
{c: [
{v: "2013-05-02"},
{v: 25}
]},
{c: [
{v: "2013-05-03"},
{v: 203}
]},
{c: [
{v: "2013-05-04"},
{v: …Run Code Online (Sandbox Code Playgroud) 我有一个转发器控件内的dropdownlist,我正在尝试获取值,并且我得到"对象引用未设置为对象的实例".我不知道还有什么可以尝试的.谢谢
ASPX代码:
<asp:Repeater ID="GeneralRepeater" runat="server"
OnItemDataBound="GeneralRepeater_OnItemDataBound"
onitemcommand="GeneralRepeater_ItemCommand">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<tr>
<td class="style2">
</td>
<td class="style2">
<asp:DropDownList ID="GeneralDDL" AppendDataBoundItems="true" DataTextField="DiagnosisCode"
DataValueField="DiagnosisCode" runat="server" AutoPostBack="True" />
</td>
</tr>
</ItemTemplate>
<FooterTemplate></FooterTemplate>
</asp:Repeater>
</asp:Panel>
Run Code Online (Sandbox Code Playgroud)
代码背后:
protected void GeneralRepeater_OnItemDataBound(object sender,
RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
DropDownList myDDL = (DropDownList)e.Item.FindControl("GeneralDDL");
Diagnosis oDiagnosis = new Diagnosis();
DataView dv = new DataView(oDiagnosis.GetDiagnosis());
myDDL.DataSource = dv;
myDDL.DataTextField = "DiagnosisCode";
myDDL.DataValueField = "DiagnosisCode";
myDDL.DataBind();
}
}
protected void cmdSave_Click(object sender, EventArgs e)
{
string …Run Code Online (Sandbox Code Playgroud) 我无法将通知发送到iphone.一切似乎都很好,因为服务很好,但要给iphone留言.
这是代码:
using (NetworkStream networkStream = client.GetStream())
{
Console.WriteLine("Client connected.");
//X509Certificate clientCertificate = new X509Certificate(@"C:\Users\yagizozturk\Documents\Visual Studio 2010\Projects\GarantiKampanya\Garanti.Web.Service\apns-prod.pem", "");
X509Certificate clientCertificate = new X509Certificate(@"C:\Users\yagizozturk\Documents\Visual Studio 2010\Projects\GarantiKampanya\Garanti.Web.Service\apns-prod-cert.p12", "1234567");
X509CertificateCollection clientCertificateCollection = new X509CertificateCollection(new X509Certificate[1] { clientCertificate });
// Create an SSL stream that will close the client's stream.
SslStream sslStream = new SslStream(
client.GetStream(),
false,
new RemoteCertificateValidationCallback(ValidateServerCertificate),
null
);
try
{
sslStream.AuthenticateAsClient("gateway.sandbox.push.apple.com", clientCertificateCollection, SslProtocols.Default, false);
}
catch (AuthenticationException e)
{
Console.WriteLine("Exception: {0}", e.Message);
if (e.InnerException != null)
{
Console.WriteLine("Inner exception: {0}", e.InnerException.Message); …Run Code Online (Sandbox Code Playgroud) c# ×5
angularjs ×2
asp.net ×1
datarow ×1
datatable ×1
dictionary ×1
iphone ×1
json ×1
push ×1
sql-server ×1
threadpool ×1