试图获得一些记录。无论我做什么查询,我总是得到`!NC!`

时间:2015-06-17 21:56:27

标签: javascript sql adodb recordset

我试图从这张表中查询任何内容 目前正试图让某些东西正确归还。
无论我做什么查询,我总是得到!NC!

var connection = new ActiveXObject("ADODB.Connection");
//db name, user name, password
connection.Open("CustomerDB","admin","admin123");
var recSet = new ActiveXObject("ADODB.Recordset");

recSet.Open("SELECT * FROM Customers" , connection);
recSet.MoveFirst();
//var sQueryReturned = recSet(0);
//the above was wrong, need something like the below if statement
if (!recSet.eof){
  for (var i = 0; i < recSet.fields.count; i++){
        var value = recSet.fields(i).value;
        var name = recSet.fields(i).name;
  }
}

recSet.close;
connection.close;

//sQueryReturned was always populating as !NC!

0 个答案:

没有答案