小编Ank*_*han的帖子

无法将MySQL日期/时间值转换为System.DateTime

我收到此错误:

无法将MySQL日期/时间值转换为System.DateTime

而我正在尝试从MySQL数据库中获取数据.我的MySQL数据库中有date数据类型.但是在将其检索到我的数据表中时,它会得到上面的错误.

我怎样才能解决这个问题?

.net mysql asp.net asp.net-3.5

80
推荐指数
3
解决办法
11万
查看次数

如何在tableview中的两个单元格之间留出空间?

我希望在表视图中的两个单元格之间有一个空格,

我想要这样的细胞,

在此输入图像描述

我怎样才能做到这一点?

iphone cocoa-touch objective-c uitableview ios4

49
推荐指数
10
解决办法
9万
查看次数

Iphone:如何在图像视图中显示文档目录图像?

在存储在文档目录文件夹中的App图像中,

我想在图像视图中显示特定的图像,

该图像如何在文档目录中的图像视图中显示?

iphone cocoa-touch objective-c ios4

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

如何拆分以","分隔的字符串中的项目

在我的应用程序中,数据以字符串形式出现

"Hi,Hello,Bye"
Run Code Online (Sandbox Code Playgroud)

我想用","分隔数据

我怎样才能做到这一点?

iphone cocoa-touch objective-c ios4

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

在iOS 10的通知栏中显示带有远程通知(富媒体推送通知)的图像

我已经集成了APNS,并希望在远程通知中显示图像,如下所示;

在此处输入图片说明

我已经在下面的代码中使用了参考链接

AppDelegate.h

#import <UserNotifications/UserNotifications.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate,UNUserNotificationCenterDelegate>
Run Code Online (Sandbox Code Playgroud)

AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     [self registerForRemoteNotification];
     UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
     UIViewController *vc1 = [storyboard instantiateViewControllerWithIdentifier:@"mainscreen"];
     self.window.rootViewController = vc1;
     return YES;
}

- (void)registerForRemoteNotification 
{
        if(SYSTEM_VERSION_GRATERTHAN_OR_EQUALTO(@"10.0")) {
            UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
            center.delegate = self;
            [center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error){

                 [[UIApplication sharedApplication] registerForRemoteNotifications];
            }];
        }
        else {
            [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
            [[UIApplication …
Run Code Online (Sandbox Code Playgroud)

objective-c apple-push-notifications ios ios10 usernotifications

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

iphone:如何利用我的文本字段的第一个字符?

在我的iPhone应用程序中,我想要将UITextField文本中的第一个字符大写.

怎么做到呢?

cocoa-touch uitextfield ios

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

如何获得(MM/dd/yyyy hh:MM a)格式的日期和时间?

在我的应用程序中,我必须显示日期和时间这样,

10/19/2011 3pm

目前我写这个代码,

NSDateFormatter *formatar=[[NSDateFormatter alloc] init];       
[formatar setDateFormat:@"MM/dd/YYYY   HH:mm a"];
[formatar setTimeStyle:NSDateFormatterShortStyle];
NSString *st=[formatar stringFromDate:[NSDate date]];
Run Code Online (Sandbox Code Playgroud)

但是以这种格式获取日期:

10/19/2011 15.00

那么,我怎么能在2011年10月19日下午3点格式中得到它?

iphone cocoa-touch objective-c nsdate ios4

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

发布到Web服务器后将字符串转换为DateTime时出错

我正在使用下面的代码

    DateTime dtt=new DateTime();
    dtt = Convert.ToDateTime(FromDate);


  //  DateTime dtt = DateTime.Parse(FromDate); //this also gives the same error

    con = new MySqlConnection(conString);
    con.Open();
    for (int i = 1; i <= TotalDays; i++)
    {         
        string updateHotelBooking = "Update tbl_hotelbookingdetail set `BookedRoom`=`BookedRoom`+"+1+", `AvailableRoom`=`TotalRoom`-`BookedRoom` where `HotelID`="+HotelID+" AND `CurrentDate`='"+dtt.ToString("dd-MM-yyyy")+"'";
        MySqlCommand cmd7=new MySqlCommand(updateHotelBooking,con);
        cmd7.ExecuteNonQuery();                
        dtt = dtt.AddDays(1);
    }
Run Code Online (Sandbox Code Playgroud)

这段代码在我的一个web服务中,我用于iPhone应用程序.

FromDate是在这个结构中带有值的字符串,15-11-2011它以字符串格式来自应用程序.我将它转换为DateTime,因为在总天数的循环中 I need to add day to dtt.

它在具有dtt值的本地主机上工作正常 15-11-2011 00:00:00

但是当我发布它时,它会给出错误

String was not recognize as valid DateTime

c# datetime

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

更新应用程序时,不希望替换旧数据库

在我的应用程序中我使用sqlite数据库我不想在应用程序商店中更新应用程序时替换现有数据库.

它会取代新的数据库吗?或者它将保持相同的数据库?

sqlite iphone cocoa-touch objective-c ios4

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

如何在appdelegate上查看横向和纵向模式?

我想在横向和纵向模式下运行应用程序,

如何在Appdelegate上查看横向和纵向模式?

我试着打电话

- (BOOL) isPad{ 
#ifdef UI_USER_INTERFACE_IDIOM
    return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
#else
    return NO;
#endif
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    if ([self isPad]) {
        NSLog(@"is pad method call");
        return YES;
    }
    else 
    {
        return UIInterfaceOrientationIsPortrait(interfaceOrientation);
    }

}



- (BOOL)isPadPortrait
{

    return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
            && (self.interfaceOrientation == UIInterfaceOrientationPortrait
                || self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown));
}


- (BOOL)isPadLandscape
{

    return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
            && (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight
                || self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft));

}
Run Code Online (Sandbox Code Playgroud)

但是在appdelegate类型的对象上找不到错误属性界面方向.

我怎样才能做到这一点?

iphone cocoa-touch objective-c ios4

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

iPhone:如何转换日期?

我的日期是来自服务器的字符串格式

日期输出就像这个"07/30/2011",

我想要一个日期格式"7月30日"

我怎样才能做到这一点?

iphone cocoa-touch objective-c ios4

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