在将Decimal转换为String时,我尝试了两种方法.
方法1:
string a = "100.00", b = "50.00";
string Total = (string)(Convert.ToDecimal(a) + Convert.ToDecimal(b));
Run Code Online (Sandbox Code Playgroud)
它抛出错误,无法将Decimal转换为String.
方法2:
string Total = (Convert.ToDecimal(a) + Convert.ToDecimal(b)).ToString();
Run Code Online (Sandbox Code Playgroud)
它没有抛出错误,它工作正常.
我想知道这两种转换方法之间的区别以及当我使用方法1时它为什么会抛出错误?
我有三个表StockSummary,Item,ItemSpecification.在这里,我想加入这三个表并获得Sum(StockSummary.Quantity).主要栏目如下:
TableA: StockSummary(ItemID, Quantity)
TableB: Item(ItemID, ItemName, SpecificationID)
TableC: ItemSpecification(SpecificationName, SpecificationID)
Run Code Online (Sandbox Code Playgroud)
期望的结果应该给出ItemName,SpecificationName和SUM(Quantity).如何在Inner Joins中使用Aggregate函数?
我有两个表STR_IndentDetail和PUR_POIndent
STR_IndentDetail:
IndentID ItemID POQty D1 D2 D3 RD
--------- ------- ------ ---- --- --- ---
2 1 NULL 10 20 30 NULL
2 6 NULL 20 40 60 45
Run Code Online (Sandbox Code Playgroud)
PUR_POIndent:
POID IndentID ItemID Quantity D1 D2 D3 RD
------ ---------- ------ ---------- ---- --- --- ---
2 2 1 55 10 20 30 NULL
2 2 6 100 20 40 60 45
Run Code Online (Sandbox Code Playgroud)
我想用PUR_POIndent表数量更新STR_IndentDetail表POQty.我已经根据INNER JOIN和LEFT OUTER编写了两个Update语句.但两个查询仅更新一行,其中列D1,D2,D3和RD中的值.包含具有NULL值的列RD的行未获得UPDATE.如何为此案例编写更新声明.以下是我的两个更新声明.
基于内部联接:
UPDATE STR_IndentDetail
SET
POQty = PUR_POIndent.Quantity
FROM
PUR_POIndent
WHERE
PUR_POIndent.IndentID = STR_IndentDetail.IndentID AND …Run Code Online (Sandbox Code Playgroud) 我需要根据条件从一个案例转移到另一个案例.例如,这是我的代码:
switch (req.method) {
case 'GET':
alert('GET METHOD');
break;
case 'POST':
alert('POST METHOD');
break;
case 'PUT':
alert('PUT METHOD');
break;
default:
res.end();
}
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,在POST我需要检查的情况下,例如if(A === B),然后转到这样的PUT情况.这该怎么做?
我想使用ASP.Net和C#在电子邮件的正文中发送折线图。我已经编写了代码以在div标签中显示图表。我想通过邮件发送折线图。这该怎么做?
My Code: jQuery
var chartData;
google.load("visualization", "1", { packages: ["corechart"] });
function Chart() {
$.ajax({
url: "HHT_Tracking.aspx/GetData",
data: "",
dataType: "json",
type: "POST",
contentType: "application/json; chartset=utf-8",
success: function (data) {
chartData = data.d;
},
error: function () {
alert("Error loading data! Please try again.");
}
}).done(function () {
//google.setOnLoadCallback(drawChart);
drawChart();
});
};
function drawChart() {
var data = google.visualization.arrayToDataTable(chartData);
var options = {
title: "Server Monitoring Date Wise",
pointSize: 5,
vAxis: { slantedText: true, slantedTextAngle: 90, title: 'MINUTES' } …Run Code Online (Sandbox Code Playgroud) 我想删除 Gridview 中的某一行。所以我需要ID,如何在GridView_RowDeleting事件中获取行的ID?
这是 GridView 的列列表,
<Columns>
<asp:TemplateField HeaderText="S.No." ControlStyle-Width="100%" ItemStyle-Width="30px">
<ItemTemplate>
<asp:Label ID="lblSrno" runat="server" Text=''
<%# Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
<ControlStyle Width="100%" />
<ItemStyle Width="30px" />
</asp:TemplateField>
<asp:TemplateField Visible="false">
<ItemTemplate>
<asp:Label runat="server" ID="lblDrawingID" Text=''
<%# Bind("DrawingID")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="CustDrawingNbr" HeaderText="Customer Drawing No." />
<asp:TemplateField HeaderText="Status" ControlStyle-Width="100px" ItemStyle-Width="100px">
<ItemTemplate>
<asp:DropDownList ID="ddlStatus" runat="server" Width="100px" Enabled="false">
</asp:DropDownList>
</ItemTemplate>
<ControlStyle Width="100px" />
<ItemStyle Width="100px" />
</asp:TemplateField>
<asp:TemplateField Visible="false">
<ItemTemplate>
<asp:Label runat="server" ID="lblDrawingPGMAStatusID" Text=''
<%# Bind("StatusID")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<ItemTemplate>
<asp:Label …Run Code Online (Sandbox Code Playgroud) 我想在物理路径中上传文件,例如E:\Project\Folders.
我在网上搜索下面的代码.
//check to make sure a file is selected
if (FileUpload1.HasFile)
{
//create the path to save the file to
string fileName = Path.Combine(Server.MapPath("~/Files"), FileUpload1.FileName);
//save the file to our local path
FileUpload1.SaveAs(fileName);
}
Run Code Online (Sandbox Code Playgroud)
但在这方面,我想像上面提到的那样给出我的物理路径.这该怎么做?
我是WCF的新手,并开始使用一个简单的无文件应用程序,其中一部分(web.config)可以在下面看到:
<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
<serviceActivations>
<add
factory="System.ServiceModel.Activation.ServiceHostFactory"
relativeAddress="./RelativeAddress.svc"
service="WCF_Transactions.MyService1"/>
</serviceActivations>
</serviceHostingEnvironment>
Run Code Online (Sandbox Code Playgroud)
现在我可以访问服务了
http://localhost:18148/RelativeAddress.svc
Run Code Online (Sandbox Code Playgroud)
然后我添加下一行:
<services>
<service name="WCF_Transactions.MyService1" behaviorConfiguration="MyBehavior1">
<host>
<baseAddresses>
<add baseAddress="http://localhost:18148/" />
</baseAddresses>
</host>
<endpoint address="/RelativeAddressX.svc" binding="basicHttpBinding" contract="WCF_Transactions.IService1"></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyBehavior1">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
Run Code Online (Sandbox Code Playgroud)
所以我希望我的服务可以通过下一个地址访问:
http://localhost:18148/RelativeAddressX.svc
Run Code Online (Sandbox Code Playgroud)
但我不能这样做.我误解了什么?
我是ASP.Net的初学者.我想知道ASP.Net中的CSS,主题和皮肤是什么?以及如何在ASP.Net中创建和使用这些东西?请用简单的例子来解释.谢谢.
我在ASP.NET Web应用程序中工作.我不知道MVC和ASP.NET MVC.我读到ASP.NET和ASP.NET MVC是不同的.我是ASP.NET的初学者.现在每个人都问过我关于ASP.NET MVC的问题.所以我对学习ASP.NET或学习ASP.NET MVC感到困惑.将来,无论是ASP.NET还是ASP.NET MVC,哪一个都会优先考虑?我需要你的所有建议.
asp.net ×6
c# ×5
sql ×2
asp.net-mvc ×1
css ×1
decimal ×1
email ×1
file-upload ×1
inner-join ×1
javascript ×1
linechart ×1
skin ×1
sql-server ×1
sql-update ×1
sum ×1
themes ×1
types ×1
wcf ×1
wcf-binding ×1
web-config ×1