标签: fetch

从数据库中获取数据时,WinForms应用程序似乎"无响应"?

我在WinForms应用程序(VB.NET)上工作,它处理CRUD操作.当它加载数据时,似乎状态为"无响应",加载完成后,每件事都是正常的.

当表单从数据库中获取记录时,如何解决类似的问题?

非常感谢你.

.net database fetch winforms

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

警告:mysql_num_rows():提供的参数不是有效的MySQL结果资源

可能重复:
警告:mysql_fetch_array():提供的参数不是有效的MySQL结果

我在下面的代码(在查询的末尾)收到以下错误消息:

警告:mysql_num_rows():提供的参数不是第28行的../view-ind-order.php中的有效MySQL结果资源

该脚本应该检索订单(从列出订单表中所有order_id行的页面),订单内容,订购用户和产品信息.我想我在哪里得到的错误是订单中有多个产品,但我不能确定我哪里出错了.(标题有会话启动命令)

     <?php 
      $page_title = 'Order';
      include ('./includes/header.html');

      if ( (isset($_GET['id'])) && (is_numeric($_GET['id'])) )
      {    
       $id = $_GET['id'];
       } elseif ( (isset($_POST['id'])) && (is_numeric($_POST['id'])) )
       {    
       $id = $_POST['id'];
       } else { 
       echo 'This page has been accessed in error';
       include ('./includes/header.html'); 
       exit();
      }

 require_once ('mydatabase.php'); 

 $query = "SELECT us.users_id, us.users_first_name, us.users_surname, us.users_business, 
             ord.order_id, ord.users_id, ord.total, ord.order_date,  
             oc.oc_id, oc.order_id, oc.products_id, oc.quantity, oc.price
             prd.products_id, prd.products_name, prd.price      
         FROM users AS us, orders AS ord, order_contents AS oc, products AS …
Run Code Online (Sandbox Code Playgroud)

php mysql fetch

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

mysql_fetch_array只返回一行

好的,我有以下代码:

$array = mysql_query("SELECT artist FROM directory WHERE artist LIKE 'a%' 
        OR artist LIKE 'b%' 
        OR artist LIKE 'c%'");
    $array_result= mysql_fetch_array($array);
Run Code Online (Sandbox Code Playgroud)

然后,当我尝试回显内容时,我只能回显$array_result[0];,它输出第一个项目,但如果我尝试回显,$array_result[1];我得到一个未定义的偏移量.

然而,如果我通过PHPMyAdmin运行上述查询,它将返回10个项目的列表.为什么这不被识别为10个项目的数组,允许我回显0-9?

谢谢您的帮助.

php mysql fetch

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

ios和coredata:NSPredicate不适用于获取请求

我有以下课程

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>


@interface Bankdaten : NSManagedObject

@property (nonatomic, retain) NSString * blz;
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSString * https;

@end
Run Code Online (Sandbox Code Playgroud)

和实施

#import "Bankdaten.h"

@implementation Bankdaten

@dynamic blz;
@dynamic name;
@dynamic https;

@end
Run Code Online (Sandbox Code Playgroud)

我检查了该对象的数据是否正确地由我的sqlite数据库中的相应表中的核心数据保存.

现在,我想通过执行此请求来获取特定对象:

-(Bankdaten*) ladeBankdaten:(NSString*) blz
{
    NSEntityDescription *entityDescription = [NSEntityDescription entityForName:@"Bankdaten" inManagedObjectContext:moc];
    NSFetchRequest *request = [[NSFetchRequest alloc] init];
    [request setEntity:entityDescription];

    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(blz == '%@')", blz];
    [request setPredicate:predicate];

    NSError *error = nil;
    NSArray *array = [moc executeFetchRequest:request error:&error]; …
Run Code Online (Sandbox Code Playgroud)

core-data fetch ios

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

为什么`git show-ref FETCH_HEAD`为空?

我获取了远程存储库,并将其存储在其中FETCH_HEAD,它有一些内容

cat .git/FETCH_HEAD     
# => d11f8ef4a4735a4193633ed2fed90e441d9ce0f8 branch 'hotfix' of xxx
Run Code Online (Sandbox Code Playgroud)

git-fetch没有显示

git show-ref FETCH_HEAD 
# => nothing
Run Code Online (Sandbox Code Playgroud)

为什么?以及如何从FETCH_HEAD获取最后一次提交的SHA?

git fetch

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

解析检索到的Facebook好友详细信息数据

我使用FQL查询一次检索好友列表:

-(void)fetchSaveUserFriendDetails
{
 NSString* query = [NSString stringWithFormat:@"SELECT uid,name,birthday_date FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())"];

 // Set up the query parameter
  NSDictionary *queryParam = [NSDictionary dictionaryWithObjectsAndKeys:
                                    query, @"q", nil];
 // Make the API request that uses FQL
  [FBRequestConnection startWithGraphPath:@"/fql"
                                     parameters:queryParam
                                     HTTPMethod:@"GET"
                              completionHandler:^(FBRequestConnection *connection,
                                                  id result,
                                                  NSError *error) {
    if (!error)
    {
       NSLog(@"result is %@",result);

       NSArray *resultData = [result objectForKey:@"data"];
       if ([resultData count] > 0) {
       for (NSUInteger i=0; i<[resultData count] ; i++) { …
Run Code Online (Sandbox Code Playgroud)

iphone facebook friend fetch details

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

检查Java/Android中的文件扩展名

如何检查jsonResponce中从服务器发送的URL的FileExtension.

如果我的URL最后有".flv",我想传递一个方法.

例如

http://derana.lk/apps/apple/tvderana/iframe_video.php?file=SriGauthamaSambuddha_35_19673.flv

上面的链接最后有".flv".所以我知道这是一个flv视频.我想知道一种方法,以检查我的网址到底是否有.flv,以及是否已通过方法.

java url flv android fetch

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

获取函数返回Promise <pending>

所以我的代码在这里返回一个Promise,因为我使用then语法,我不知道为什么会发生这种情况: - ??

fetch('someurltoAJsonFile.json')
  .then(function(response) {
    console.log(response.json());});
Run Code Online (Sandbox Code Playgroud)

javascript json fetch

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

通过使用axios和Fetch in react被CORS策略阻止

我正在尝试执行服务器的后期请求,但使用axios不断获取CORS错误并在React中获取。

代码:

fetch('https://api/entries', 
    { mode: 'no-cors',
      method: 'post',
      headers: {
        "Content-Type":"application/octet-stream",
        'Access-Control-Allow-Origin': true
      }, 
      body: JSON.stringify({
        "KEY":"VALUE"
      })
    })

  .then((response) => {
    console.log(response) 
  })
  .catch(err => console.log(err))
Run Code Online (Sandbox Code Playgroud)

要么


axios({
      method: 'post',
      url: 'https://api/entries',
      headers: {
        "Content-Type":"application/octet-stream",
        'Access-Control-Allow-Origin': true
      }, 
      data: {
            "KEY":"VALUE"

      }
    })
    .then(response => {

          console.log(response);
        })
    .catch(err => console.log(err));

Run Code Online (Sandbox Code Playgroud)

axios控制台响应

Access to XMLHttpRequest at 'https://api/entries' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have …
Run Code Online (Sandbox Code Playgroud)

xmlhttprequest fetch axios

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

多个API调用,并在chain和Promise.all中进行提取

我正在函数中进行API调用以获取一些数据。然后,我需要根据第一个调用中的特定值,对返回的每个数据项进行多个API调用。我在渲染状态时遇到问题,在渲染期间不存在从多个promise添加的值。

到目前为止,我有这样的事情:

fetch(url)
.then(resp => resp.json())
.then(data => {
  //do some calculations and populate new array and return it
})
.then(data => {
   const newData = [...data];
   Promise.all(functionWhichReturnsArrayOfPromises).then(el => {
      // more calculation
      newData.push(el.someValue);
   })
   return newData;
})
.then(data => this.setState({data: data}))
Run Code Online (Sandbox Code Playgroud)

返回promise数组的函数如下所示:

fetchMoreData(arr) {
   const promises = arr.map(el => {
      return fetch(someUrl)
      .then(data => data.json())
      .then(data => data)
   })
   return promises;
}
Run Code Online (Sandbox Code Playgroud)

我认为将Promise.all链接到另一个Promise不好,是否有推荐且更优雅的方式来实现此目的?

javascript fetch reactjs es6-promise

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