嗨,我正在寻找将这种格式的英文日期转换dd/MMM/yyyy为阿拉伯日期的方法
例如18/Feb/2016将是阿拉伯语 ??/??????/????
下面的方法以这种格式将日期发送到文本框Wed Sep 14 2016 00:00:00 GMT+0400。所以我尝试使用子字符串方法来获取这种格式的日期 Sep 14 2016
我在下面的代码中尝试过,但没有成功
它返回这个错误Uncaught TypeError: date.substring is not a function
<script>
$(document).ready(function () {
var dateval = $('#<%= txtdate.ClientID %>').val();
if (dateval != '') {
var options = {
selectedDate: dateval,
size: 'medium',
width: 960
}
} else {
var options = {
size: 'medium',
width: 960
}
}
$('#paginator').datepaginator(options);
$('#paginator').on('selectedDateChanged', function (event, date) {
$('#<%= txtdate.ClientID %>').val(date.substring(4, 12));
});
});
</script>
Run Code Online (Sandbox Code Playgroud) 如何使用 css 应用图像中显示的效果
<div class="textstyle"><b>Sales Cash Invoice</b></div>
Run Code Online (Sandbox Code Playgroud)
我想使用以下查询获取总金额
SELECT SUM(Quantity * UnitPrice * (Discount/100))
FROM Stock_Purchase_Details
Run Code Online (Sandbox Code Playgroud)
我的桌子结构
Proid | unitprice | discountrate(inpercentage) | proqty
1 | 10.00 | 10.00 | 10
2 | 10.00 | 10.00 | 10
Run Code Online (Sandbox Code Playgroud)
我希望总金额为20.00,但我使用的查询返回此结果20.00000000- 为什么?
嗨,Attempted to divide by zero当我试图在网格视图中运行下面的代码时,我收到此错误.
如何在错误发生时返回归零而不避免除零,从而避免此错误.
码
protected void gridpandl_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
for (int index = 0; index < this.gridpandl.Rows.Count; index++)
{
string Purchase = GetPurchase(this.gridpandl.Rows[index].Cells[0].Text);
string Sales = GetSales(this.gridpandl.Rows[index].Cells[0].Text);
string Serivce = GetService(this.gridpandl.Rows[index].Cells[0].Text);
decimal Profit = (Convert.ToDecimal(Sales) + Convert.ToDecimal(Serivce) - Convert.ToDecimal(Purchase));
decimal Profitprcn = (Profit * 100) / Convert.ToDecimal(Purchase);
this.gridpandl.Rows[index].Cells[2].Text = Purchase;
this.gridpandl.Rows[index].Cells[3].Text = Sales;
this.gridpandl.Rows[index].Cells[4].Text = Serivce;
this.gridpandl.Rows[index].Cells[5].Text = Profit.ToString();
this.gridpandl.Rows[index].Cells[6].Text = Math.Round(Profitprcn, 2).ToString();
}
}
catch (DivideByZeroException ex)
{
}
}
Run Code Online (Sandbox Code Playgroud) 我使用下面的函数从数据库中获取值.
问题是当我选择int类型的列时.
我收到这个错误 Unable to cast object of type 'System.Int32' to type 'System.String'.
在这一行 result.Add(dr.GetString(0));
码
[WebMethod]
public static List<string> GetAutoCompleteData(string value, string filterBy)
{
string strConnString = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
using (SqlConnection con = new SqlConnection(strConnString))
{
con.Open();
string command = string.Format("select {0} from Users where {0} LIKE '%'+@SearchText+'%'", filterBy);
using (SqlCommand cmd = new SqlCommand(command, con))
{
cmd.Parameters.AddWithValue("@SearchText", value);
using (SqlDataReader dr = cmd.ExecuteReader())
{
List<string> result = new List<string>();
while (dr.Read())
{
result.Add(dr.GetString(0));
}
return result;
}
}
} …Run Code Online (Sandbox Code Playgroud)