小编zar*_*rko的帖子

从数据库在控制台窗口中显示数据

我创建了这个简单的"员工"程序来训练我的sql.如果用户愿意,我决定显示数据库中的所有数据.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace MySQLQueryTest
{
class Program
{
    static void Main(string[] args)
    {
        string response = "";
        while (response != "exit")
        {
            Console.Write(">>");
            response = Console.ReadLine();
            switch (response.ToLower())
            {
                case "emp":
                    employeeMenu();
                    break;
                case "-h":
                    Console.WriteLine("emp\tDisplays the Employee database menu");
                    Console.WriteLine("exit\tWill exit the program");
                    Console.WriteLine("clear\tWill clear the console window");
                    break;
                case "clear":
                    Console.Clear();
                    break;
                default:
                    Console.WriteLine("Invalid Command; for help type -h");
                    break;

            }
        }
    }
    static void employeeMenu()
    {
        Console.WriteLine("-------------Menu-------------");
        Console.WriteLine("Type …
Run Code Online (Sandbox Code Playgroud)

c# sql visual-studio-2012

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

double.Parse 显然不适用于某些国家/地区

基本上,我有一个非常简单的计算:

int bTaxPrice = int.Parse(prices[wep]);
double t = double.Parse("1." + taxes);
double price = Math.Round(t * bTaxPrice);
Run Code Online (Sandbox Code Playgroud)

我会给你一个计算应该如何工作的例子,比如说t=1.1bTaxPrice=1279,然后1.1*1279 = 1406.9,但是因为我对结果进行了四舍五入,所以价格等于 1407。

对于使用我的 C# Winforms 程序的其他国家/地区(丹麦)的某些用户遇到的问题,该问题导致数字不四舍五入,而是添加小数点后的最后 2 位数字。

我们上面计算的结果是 1407,对他们来说是 140690。

我在互联网上读到过它,有些国家有一些特别的小数点。

这种问题有什么好的解决方法?

c# math rounding

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

红色文本框边框颜色

我有一个带有一个文本框的表单.我想检查文本框值何时为空,并在文本框为空时在文本框周围形成某种红色边框.

if (document.getElementById('pageh').value == "") {
    alert("One of the fields is empty.");
    return false;
}
Run Code Online (Sandbox Code Playgroud)

这是我的验证,但如何添加红色边框?

html javascript

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

标签 统计

c# ×2

html ×1

javascript ×1

math ×1

rounding ×1

sql ×1

visual-studio-2012 ×1