Zaloguj | Zarejestruj | FAQ
Anonymous

Javascript error: Either BOF or EOF is True, or the current

+ Odpowiedz

Posty: 2 Strona 1 z 1


Javascript error: Either BOF or EOF is True, or the current

przez jayavinoth » Śr lis 12, 2014 6:42 am

I created the below javascript to check whether the given email id is already exixt in ms access database and getting the below error. Could anyone please help me to get rid of this. Thanks in advance...

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

Kod: Zaznacz cały
    <html>
    <head>
    <script>
    function fnchk()
    {
    var eid = document.f1.t1.value;
    var cn = new ActiveXObject("ADODB.Connection");
    var rs = new ActiveXObject("ADODB.Recordset");
    cn.open("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=/\dth.accdb;");
    var qry = "select * from reg where email = '"+ eid +"'";
    rs.open(qry,cn,1,3);
    if(eid == rs.fields("email").value)
    {
    alert("Email exists");
    }
    else
    {
    alert("Email not exist");
    }
    rs.close();
    cn.close();
    }
    </script>
    </head>
    <body>
    <form name="f1">
    <input type="text" name="t1">
    <input type="button" value="ok" onclick="fnchk();">
    </form>
    </body>
    </html>
Avatar użytkownika

jayavinoth

  • Posty: 73
  • Dołączył(a): Wt maja 17, 2011 2:36 pm

Re: Javascript error: Either BOF or EOF is True, or the curr

przez XainPro » Cz lis 27, 2014 9:43 am

Connecting to a Database

To create a new database connection, use the ACCESSdb contructor to create a new instance of the ACCESSdb object, passing a string containing the path to the Access .mdb file. (Make sure to double up on the backslashes!):

var myDB = new ACCESSdb("C:\\dbfile.mdb");


To see warning popups for database errors, add the optional showErrors parameter:

var myDB = new ACCESSdb("C:\\dbfile.mdb", {showErrors:true});


Running a Query

To query a database, use ACCESSdb's query method:

var SQL = "SELECT * FROM myTable";
var resultSet = myDB.query(SQL);


var SQL = "INSERT INTO myTable VALUES(123, 'abc 123', 'xyz')";
if(myDB.query(SQL)) {
alert("Inserted!");
}


If a query fails, the method returns false:

var SQL = "UPDATE myTable SET col1 = 456, col2 = 'def 456', col3 = 'zyx' WHERE col1 = 123";
if(!myDB.query(SQL)) {
alert("Oh no!");
}
Avatar użytkownika

XainPro

  • Posty: 3933
  • Dołączył(a): Pt lut 17, 2012 8:10 pm


+ Odpowiedz

Strona 1 z 1