我有这个REGEX 几乎完美......它似乎处理除了带负号然后是小数的数字之外的所有内容.所以,如果我输入:
-.2
Run Code Online (Sandbox Code Playgroud)
我收到一个错误 -
这是我的正则表达式 - 我测试过的其他所有内容都完美无缺...
^(\+|-)?[0-9]{1,11}?(?:\.[0-9]{1,4})?$
Run Code Online (Sandbox Code Playgroud)
这允许:
这一切都有效:
-0.2345
-10
12
.125
0.1245
5.555
25000000000 (aka 25 Billion)
25000000000.25
Run Code Online (Sandbox Code Playgroud)
这些不起作用:
-.2
-.421
Run Code Online (Sandbox Code Playgroud) 这是我的代码 - 我只需要将SQL DataSet转换为asp.net 4.5中的DataTable.我似乎无法弄明白.有很多帖子正在做相反的事情,但我找不到任何明确回答的帖子.
public static DataTable getGender()
{
DataTable DT = default(DataTable);
SqlConnection con = new SqlConnection(CnnString.ConnectionString.ToString());
SqlCommand cmd = new SqlCommand("ns_gender_get", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
try
{
//Fill the Dataset
da.Fill(ds, "Results");
DT = ds.Tables(0);
//**GOAL: I need to assign the DS.Table(0) to the DT (dataTable) so when this method is called it will return the table rows in the DT.
}
catch (Exception …Run Code Online (Sandbox Code Playgroud)