ADODB.RecordSet.MoveNext上升2

时间:2019-01-02 20:08:09

标签: vba access-vba adodb recordset

我正在使用ADODB记录集将CSV导入ACCESS。我正在尝试遍历记录集以获取所需的数据,但是当我使用.MoveNext方法时,它上升2,而不是上升1。我的意思是,AbsolutePosition计数为2s(1,3,5 ..),当我使用的行计数器恰好达到记录总数的一半时,我达到了EOF

import UIKit
import WebKit

class ViewController: UIViewController{

//Outlets and variables
let webViewControllerObject = Web_View()


var username : String = ""
var password : String = ""

@IBOutlet weak var errorLabel: UILabel!

@IBOutlet weak var usernameTextField: UITextField!
@IBOutlet weak var passwordTextField: UITextField!


//Allows user to "touch off" the keyboard
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
    self.view.endEditing(true)
}

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

}



//Gathers data and holds in two varables, sends username params
@IBAction func loginRequest(_ sender: Any) {

    username = usernameTextField.text!
    password = passwordTextField.text!

    if (username.isEmpty || password.isEmpty)
    {
        errorLabel.text = "Please enter a valid login"
    }

    else if (!(username.isEmpty || password.isEmpty))
    {
        webViewControllerObject.webViewDidFinishLoadUsername()
        webViewControllerObject.webViewDidFinishLoadPassword()
    }

    else
    {
        print("rough")
    }

}


}

1 个答案:

答案 0 :(得分:1)

我正在使用的.GetRows(1)方法在检索当前记录后已经移至下一个记录。通过同时使用.MoveNext,它会使每个循环跳2。

我删除了.MoveNext,它似乎工作正常(跳1)