可能重复:
Java BitTorrent库
我想了解更多有关在Java中创建洪流客户端的信息。我在这里问这个问题,是因为我不知道要为torrent客户端开始编程的方向。我想我需要一个
有人可以指出我正确的方向。
下面提到的问题已经解决,代码已经改变以反映变化.
我想根据存储在MySQL数据库中的日期检查当前日期.检索当前日期我使用的是nist time服务器,它返回MM-DD-YYYY格式的日期,在我的数据库中,我有以"YYYY-MM-DD"格式存储的值.我想要做的是检查我通过的日期是否等于数据库中的日期,然后做一些事情.
我使用的代码如下:
// The code originally posted has been changed to reflect changes made and it is now working fine (problem solved) a big thank you to all those who replied.
DateTime currentDate = InternetTime();
//DD/MM/YYYY is returned here convert to YYYY/MM/DD
string currentDate = x.ToString("yyyy-MM-dd");
con = new MySqlConnection(conString);
MySqlDataAdapter da = new MySqlDataAdapter();
MySqlCommand cmd = new MySqlCommand("SELECT id AS oDates FROM open_dates WHERE dates=?currentDate",con);
cmd.Parameters.AddWithValue("?currentDate",currentDate);
da.SelectCommand = cmd;
DataTable dt = new DataTable("openDates");
da.Fill(dt);
Run Code Online (Sandbox Code Playgroud)
"dt"表保持为空,因为TryParseExact没有向dateValue写任何内容,所以它仍然是"01-01-0001"或类似的东西.我哪里错了?如果有人能帮助我会很棒.实际上有一个我想到的解决方法; …