您的位置:程序门 -> vb -> 基础类



急急!!!求助:vb运行出现“编译错误:未找到方法或数据成员" 


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


急急!!!求助:vb运行出现“编译错误:未找到方法或数据成员"
发表于:2007-11-27 17:21:13 楼主
 
  拜托!拜托!虽然有点长,但本人真的很着急,感谢感谢感谢!!!!  


public   function   EXECutesql(byval   sql   as   string,   msgstring   as   string)   as   adodb.recordset  
    dim   cnn   as   adodb.connection  
    dim   rst   as   adodb.recordset  
    dim   stokens()   as   string  
    on   error   goto   EXECutesql_error  
    stokens   =   split(sql)  
    set   cnn   =   new   adodb.connection  
    cnn.open   connectstring  
        if   instr("insert,delete,update",   ucase$(stokens(0)))   then  
              cnn.EXECute   sql                
              msgstring   =   stokens(0)   &   "query   successful"  
        else  
              set   rst   =   new   adodb.recordset  
            rst.open   trim$(sql),   cnn,   adopendeyset,   adlockoptimistic  
            rst.movelast         'get   recordcount  
            set   EXECutesql   =   rst  
            msgstring   =   "查询到"   &   rst.recordcount   &   "条记录"  
      end   if  
      EXECutesql_exit:  
      set   rst   =   nothing  
      set   cnn   =   nothing  
      exit   function  
      EXECutesql_error:  
      msgstring   =   "查询错误:"   &   err.description  
      resume   EXECutesql_exit  
end   function  


public   function   connectstring()   as   string  
            connectstring   =   "filedsn=student_info.dsn;uid=student_id;pwd="  
end   function  
public   function   testtxt(txt   as   string)   as   boolean  
      if   trim(txt)   =   ""   then  
                  testtxt   =   false  
        else  
                  testtst   =   true  
      end   if  
end   function  

sub   main()  
      dim   flogin   as   new   frmlogin  
            frmlogin.show   vbmodal  
            if   not   flogin.ok   then  
                'login   failed   so   exit   app  
                end  
        end   if  
        unload   frmlogin  

        set   fmainform   =   new   frmmain  
        fmainform.show  
end   sub  
public   username   as   string  
其中sub   main以黄色显示,flogin.ok中的.ok以蓝色显示  
改来改去不知道,请各位高手赐教,万分感谢!!!!!!!!!!      
 
 
发表于:2007-11-27 17:32:551楼 得分:0
错误提示说得已经很清楚了.

flogin似乎是你自己定义的一个窗体,里面有ok这个属性或方法吗?
发表于:2007-12-04 21:16:512楼 得分:0
非常谢谢!!!!!!因为刚刚学vb不久,第一次尝试做这样的东东,所以请多多赐教..........
再帮我看一哈哈........
检查了一下,好像有ok这个的属性的

frmlogin窗体中的代码如下:

option   explicit
public   ok   as   boolean
dim   micount   as   integer
private   sub   form_load()
          ok   =   false
    micount   =   0
end   sub

private   sub   cmdcancel_click()
        ok   =   false
        me.hide
end   sub

private   sub   cmdok_click()
        dim   txtsql   as   string
        dim   mrc   as   adodb.recordset
        dim   msgtext   as   string
        username   =   ""
        if   trim(txtusername.text   =   "")   then
              msgbox   "没有这个用户,请重新输入用户名!",   vbokonly   +   vbexclamation,   "警告"
              txtusername.setfocus
        else
            txtsql   =   "select   from   user_info   where   user_id='"   &   txtusername.text   &   "'"
            set   mrc   =   EXECutesql(txtsql,   msgtext)
              if   mrc.eof   =   true   then
                    msgbox   "没有这个用户,请重新输入用户名!",   vbokonly   +   vbexclamation,   "警告"
                    txtusername.setfocus
              else
                    if   trim(mrc.fields(1))   =   trim(txtpassword.text)   then
                    ok   =   true
                    mrc.close
                    me.hide
                    username   =   trim(txtusername.text)
              else
                          msgbox   "输入密码不正确,请重新输入!",   vbokonly   +   vbexclamation,   "警告"
                          txtpassword.setfocus
                          txtpassword.text   =   ""
              end   if
        end   if
end   if
micount   =   micount   +   1
if   micount   =   3   then
        me.hide
end   if
exit   sub
end   sub



快速检索

最新资讯
热门点击