vb6 - MySQL Run-time error '-2147217865 (80040e37)' -
windows 7 (x64), vb6.0 - sp6 , mysql 5.2 odbc connectors , xammp server
that works on local host trying connect remote mysql database same tables after successful connection gives me run-time error '-2147217865 (80040e37)' , says table mydatabase.tblusers doesn't exist exist in database. searched on internet possible solution still not working me
here connection string
option explicit public function connected2db() boolean dim isopen boolean dim ans vbmsgboxresult dim dbpath string isopen = false on error goto err until isopen = true cn.cursorlocation = aduseclient cn.connectionstring = "provider=msdasql;driver={mysql odbc 5.2 ansi driver};dsn=mydsn;server=myipaddress;database=mydatabase;uid=dbusername;pwd=mypassword;port=3306;" cn.open isopen = true loop connected2db = isopen exit function err: ans = msgbox("error number: " & err.number & vbcrlf & "description: " & err.description, _ vbcritical + vbretrycancel) if ans = vbcancel connected2db = false elseif ans = vbretry connected2db = vbretry end if end function public sub closedb() 'close connection cn.close set cn = nothing end sub
and here code
private sub cmdlogin_click() dim strpass string if txtusername.text = "" msgbox "username and/or password incorrect.try again!", vbexclamation txtusername.setfocus exit sub end if if txtpassword.text = "" msgbox "username and/or password incorrect.try again!", vbexclamation txtpassword.setfocus exit sub end if strpass = encode(txtpassword.text) 'strpass = txtpassword.text set rs = new adodb.recordset 'if rs.state = adstateopen rs.close rs.open "select tblusers.* tblusers username='" & txtusername.text & "' , password ='" & strpass & "' , statuscd ='active'", cn, adopenstatic, adlockreadonly if rs.recordcount < 1 attempt = attempt - 1 msgbox "username and/or password incorrect.try again!", vbexclamation lblattempt.caption = "remaining attempt(s): " & attempt if attempt = 0 msgbox "you have reached maximum login attempts. system terminated!", vbexclamation mdimain.closeme = true end_app = true unload me end if else login_succeeded = true active_user.userid = rs.fields("usercd") active_user.fullname = rs.fields("fullname") active_user.username = rs.fields("username") active_user.passcode = rs.fields("password") active_user.user_isadmin = cbool(changeynvalue(getvalueat("select username,isadmin tblusers username='" & txtusername.text & "'", "isadmin"))) blncreate = cbool(changeynvalue(rs.fields("modcreate"))) blnupdate = cbool(changeynvalue(rs.fields("modupdate"))) blndelete = cbool(changeynvalue(rs.fields("moddelete"))) 'insertlogs name, "action taken: logged in program", "executed:" & time mdimain.lblcurrentuser.caption = active_user.fullname mdimain.lbldate.caption = now() 'format(now, "mmmm dd, yyyy") unload me mdimain.show end if end sub
remote server permissions accept table names (case sensitive) double check tables names on remote server in code. issue resolved renaming mysql statements of relevant tables
Comments
Post a Comment