小编Aym*_*man的帖子

如何在 .Net 中将英文日期转换为阿拉伯文日期

嗨,我正在寻找将这种格式的英文日期转换dd/MMM/yyyy为阿拉伯日期的方法

例如18/Feb/2016将是阿拉伯语 ??/??????/????

c# asp.net

5
推荐指数
1
解决办法
9607
查看次数

使用子字符串格式化 JavaScript 日期

下面的方法以这种格式将日期发送到文本框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)

javascript jquery

5
推荐指数
1
解决办法
2万
查看次数

文本周围的圆形边框

如何使用 css 应用图像中显示的效果

<div class="textstyle"><b>Sales Cash Invoice</b></div>
Run Code Online (Sandbox Code Playgroud)

文本

html css

2
推荐指数
1
解决办法
2万
查看次数

整数除法SQL查询产生意外的小数位数

我想使用以下查询获取总金额

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- 为什么?

sql sql-server sql-server-2008

1
推荐指数
1
解决办法
144
查看次数

如何避免DivideByZeroException

嗨,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)

c# asp.net gridview

1
推荐指数
1
解决办法
206
查看次数

错误无法将"System.Int32"类型的对象强制转换为"System.String"类型

我使用下面的函数从数据库中获取值.

问题是当我选择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)

c# asp.net

0
推荐指数
1
解决办法
8325
查看次数

标签 统计

asp.net ×3

c# ×3

css ×1

gridview ×1

html ×1

javascript ×1

jquery ×1

sql ×1

sql-server ×1

sql-server-2008 ×1