乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      看實例學(xué)VFP:模糊查詢

       happyngkmw 2012-09-08

      看實例學(xué)VFP:模糊查詢

      時間:2009-02-11 本站 老馬
      -

      本文是在vfp中使用select語句的like子句的一個例子,關(guān)于like子句請參考:select SQL 命令sql語言教程。

      本例運行時如下圖:

      本例用到了“數(shù)據(jù)1”數(shù)據(jù)庫中的“網(wǎng)站信息表”,關(guān)于該數(shù)據(jù)庫的情況已經(jīng)在看實例學(xué)VFP:示例數(shù)據(jù)庫一文中給出,這里不再詳述。
       

      制作步驟如下:

      一、新建表單form1,并將其caption屬性值設(shè)為“模糊查詢”,width屬性值設(shè)置為290,height屬性值設(shè)置為175,AutoCenter屬性值設(shè)置為.t.,并將其保存為“模糊查詢.scx”。

      二、向表單添加一個grid控件,并將其width屬性值設(shè)置為290,height屬性值設(shè)置為100。

      三、在grid控件的下方添加兩個label控件,將它們的caption屬性值分別設(shè)置為“請選擇查找方式”和“請輸入要查找的內(nèi)容”。

      四、在label控件的下方添加一個組合框控件Combo1和一個文本框控件,并將組合框控件的RowSourceType屬性值設(shè)置為“1-值”,RowSource屬性值設(shè)置為“編號,網(wǎng)站名稱,網(wǎng)站網(wǎng)址”。

      五、在文本框的右側(cè)再添加兩個命令按鈕command1和command2,并將command1和command2的caption屬性值分別設(shè)置為“查找”和“恢復(fù)”。

      六、對表單上各控件的位置進(jìn)行適當(dāng)?shù)恼{(diào)整,調(diào)整后的表單設(shè)計器如下圖:

      七、添加事件代碼:

      (一)表單的unload事件:close data

      (二)表單的init事件:

      use 網(wǎng)站信息表
      this.Combo1.value="編號"
      with thisform.grid1
          .recordsource="網(wǎng)站信息表"
          .deletemark=.f.
          .visible=.t.
      .readonly=.t. .ColumnCount=3 .Column1.Header1.Caption="編號" .Column1.Header1.BackColor=RGB(255,255,190) .Column2.Header1.BackColor=RGB(255,255,190) .Column2.Header1.Caption="網(wǎng)站名稱" .Column3.Header1.BackColor=RGB(255,255,190) .Column3.Header1.Caption="網(wǎng)站網(wǎng)址" .Column1.width=75 .Column2.width=80 .Column3.width=150 endwith thisform.grid1.Setall("DynamicBackColor","RGB(224,225,255)","Column")

      (三)“查找”按鈕(command1)的click事件:

      if empty(thisform.Text1.value)=.f.
      go top
      a=thisform.Combo1.value
      b=alltrim(thisform.Text1.value)
      local c as integer
        if a="編號"
           Select * from 網(wǎng)站信息表 where 編號 like b +"%" into cursor 臨時網(wǎng)站信息表
           sele 臨時網(wǎng)站信息表
           c=reccount()
           if c<1
             use
             messagebox("數(shù)據(jù)庫中不存在您所要查詢的記錄",16,"系統(tǒng)提示")
             thisform.command2.click()
             return
           endif
        endif
        if a="網(wǎng)站名稱"
           Select * from 網(wǎng)站信息表 where 網(wǎng)站名稱 like b +"%" into cursor 臨時網(wǎng)站信息表
           sele 臨時網(wǎng)站信息表
           c=reccount()
           if c<1
             use
             messagebox("數(shù)據(jù)庫中不存在您所要查詢的記錄",16,"系統(tǒng)提示")
             thisform.command2.click()
             return
           endif
        endif
        if a="網(wǎng)站網(wǎng)址"
           Select * from 網(wǎng)站信息表 where 網(wǎng)站網(wǎng)址 like b +"%" into cursor 臨時網(wǎng)站信息表
           sele 臨時網(wǎng)站信息表
           c=reccount()
           if c<1
             use
             messagebox("數(shù)據(jù)庫中不存在您所要查詢的記錄",16,"系統(tǒng)提示")
             thisform.command2.click()
             return
           endif
        endif
        with thisform.grid1
          .width=350
          .height=100
          .left=10
          .recordsource="臨時網(wǎng)站信息表"
          .deletemark=.f.
          .visible=.t.
          .readonly=.t.
          .ColumnCount=3
          .Column1.Header1.Caption="編號"
          .Column1.Header1.BackColor=RGB(255,255,190)
          .Column2.Header1.BackColor=RGB(255,255,190)
          .Column2.Header1.Caption="網(wǎng)站名稱"
          .Column3.Header1.BackColor=RGB(255,255,190)
          .Column3.Header1.Caption="網(wǎng)站網(wǎng)址"
          .Column1.width=75
          .Column2.width=80
          .Column3.width=150
        endwith
        thisform.grid1.Setall("DynamicBackColor","RGB(224,225,255)","Column")
        thisform.grid1.setfocus
      else
        messagebox("請輸入要查找的內(nèi)容!",16,"系統(tǒng)提示")
        thisform.Text1.value=""
        thisform.Text1.Setfocus
      endif

      (四)“恢復(fù)”按鈕(command2)的click事件:

      sele 網(wǎng)站信息表
      go top
      thisform.Text1.value=""
      thisform.Text1.Setfocus
      with thisform.grid1
          .width=350
          .height=100
          .left=10
          .recordsource="網(wǎng)站信息表"
          .visible=.t.
          .readonly=.t.
          .ColumnCount=3
          .Column1.Header1.Caption="編號"
          .Column1.Header1.BackColor=RGB(255,255,190)
          .Column2.Header1.BackColor=RGB(255,255,190)
          .Column2.Header1.Caption="網(wǎng)站名稱"
          .Column3.Header1.BackColor=RGB(255,255,190)
          .Column3.Header1.Caption="網(wǎng)站網(wǎng)址"
          .Column1.width=75
          .Column2.width=80
          .Column3.width=150
      endwith
      thisform.grid1.Setall("DynamicBackColor","RGB(224,225,255)","Column")
      thisform.refresh
      

      八、運行“模糊查詢.scx”。

      參考資料:

      vfp基礎(chǔ)教程:http:///vfpjc/index0.htm

      vfp初級教程:http:///cc/index.htm

      vfp中級教程:http:///mcc/mcc.htm

      vfp高級教程:http:///hcc/hcc.htm

      VFP網(wǎng)絡(luò)開發(fā):http:///VFPwz/vfpwlkf.htm

      vfp調(diào)用api函數(shù):http:///VFPwz/vfpapi.htm

      VFP報表打?。篽ttp:///VFPwz/vfpreport.htm

      VFP常用技術(shù):http:///VFPwz/vfpcyjs.htm

      VFP經(jīng)驗匯總:http:///VFPwz/vfpjyhz.htm

      VFP控件使用:http:///VFPwz/vfpkjsy.htm

      VFP數(shù)據(jù)處理:http:///VFPwz/vfpsjcl.htm

      本例代碼在Win2003+VFP6.0環(huán)境下調(diào)試通過。

      查看全套“菜鳥也學(xué)VFP”教程

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多