如何使用C#从互联网或服务器获取当前日期和时间?我想时间如下:
public static DateTime GetNetworkTime (string ntpServer)
{
IPAddress[] address = Dns.GetHostEntry(ntpServer).AddressList;
if (address == null || address.Length == 0)
throw new ArgumentException("Could not resolve ip address from '" + ntpServer + "'.", "ntpServer");
IPEndPoint ep = new IPEndPoint(address[0], 123);
return GetNetworkTime(ep);
}
Run Code Online (Sandbox Code Playgroud)
我正在传递服务器IP地址netServer,但它无法正常工作.
我不是mysql的专家.我在MySql中有数据库.当删除某些表中的行时,我想在另一个表中添加主键.我可以在执行删除查询之前执行此操作,从表中获取该主键并将其从应用程序级别插入另一个表.但我想从数据库级别那样做.我怎样才能做到这一点?
我有uitextview文本.我想逐行阅读.我希望它适用于iOS 5并且没有- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text;委托方法.我怎样才能做到这一点?