E_FAIL error

Results 1 to 2 of 2

Thread: E_FAIL error

  1. #1
    Join Date
    Dec 1969

    Default E_FAIL error

    Im getting this error, been trying for hours to fix it, but wont work. any clues? using mySql btw.<BR><BR>Microsoft Cursor Engine error &#039;80020009&#039; <BR><BR>Data provider or other service returned an E_FAIL status. <BR><BR>/sqltest.asp, line 0 <BR><BR><BR> dbConnectionString = "driver={MySQL ODBC 3.51 Driver};server=xx;uid=xx;pwd=xx;database=xx;option =NUM"<BR> dim rs, cmd, objConn<BR> p_strsql = "SELECT * FROM Emne WHERE (lngEmneID = 1)"<BR> Set rs = Server.CreateObject("adodb.Recordset")<BR> Set cmd = Server.CreateObject("adodb.Command")<BR> <BR> &#039;Run the SQL<BR> cmd.ActiveConnection = dbConnectionString<BR> cmd.CommandText = p_strSQL<BR> cmd.CommandType = adCmdText<BR> cmd.Prepared = true<BR><BR> rs.CursorLocation = adUseClient<BR> rs.Open cmd, , adOpenForwardOnly, adLockReadOnly<BR><BR> if Err &#060;&#062; 0 then<BR> Err.Raise Err.Number, "ADOHelper: RunSQLReturnRS", Err.Description<BR> end if<BR><BR> response.write rs("lngEmneID") <BR> &#039; Disconnect the recordsets and cleanup <BR> Set rs.ActiveConnection = Nothing <BR> Set cmd.ActiveConnection = Nothing<BR> Set cmd = Nothing<BR> &#039;Constants are given under, no need to post them as well

  2. #2
    Join Date
    Dec 1969

    Default Use a connection OBJECT...

    ...instead of a connection string.<BR><BR>See if that makes a diff.<BR><BR>And do *NOT* use a COMMAND object, at all.<BR><BR>And your ERR check is bogus. If you aren&#039;t using On Error Resume Next (and you shouldn&#039;t, at this time!), then you&#039;ll never get to the IF ERR test. And shouldn&#039;t that be IF Err.Number &#060;&#062; 0 anyway?<BR><BR>*********<BR>dbConnectionString = "driver={MySQL ODBC 3.51 Driver};server=xx;uid=xx;pwd=xx;database=xx;option =NUM"<BR>Set conn = Server.CreateObject("adodb.Connection")<BR>conn.Op en dbConnectionString<BR><BR>p_strsql = "SELECT * FROM Emne WHERE (lngEmneID = 1)"<BR><BR>Set RS = conn.Execute( p_strsql )<BR><BR>response.write rs("lngEmneID") <BR>&#039; Disconnect the recordsets and cleanup <BR>RS.Close<BR>Conn.Cloe<BR>Set RS = Nothing <BR>Set Conn = Nothing<BR>%&#062;<BR><BR>***********<BR><BR>I think I saw your goof, in the process of tossing out all the overly verbose code: You did<BR> cmd.Prepared = True<BR>and that was lie. That query was most certainly not a "prepared statement".<BR><BR>Anyway, if you will just do read-only and forward-only recordsets, use the pattern shown above. It&#039;s the least error prone and by far the fastest.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts