最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

淺談如何使用vb.net從數(shù)據(jù)庫中提取數(shù)據(jù)

 更新時(shí)間:2020年07月14日 17:31:49   作者:sxjljj  
這篇文章主要介紹了淺談如何使用vb.net從數(shù)據(jù)庫中提取數(shù)據(jù),使用VB提取數(shù)據(jù),是先查找,做成數(shù)組,再顯示到數(shù)據(jù)里,如果感興趣可以了解一下

1.設(shè)置從Model中的Sub Main 啟動

2.程序結(jié)構(gòu)

3.Model1

Imports System.Windows.Forms.Application
Module Module1
 Sub Main()
  'form1 是測試多文檔窗口
  'Dim frm1 As New Form1()
  'frm1.Show()
  Dim formStudentSysMain As New FormStudentSysMain()
  formStudentSysMain.Show()
  Do While True
   DoEvents()
  Loop

 End Sub
End Module

4.FormStudentSysMain.vb

Imports System.Data.SqlClient
Public Class FormStudentSysMain
 Public DBConnstr As String = "Data Source=LJJ-FF\LJJ;Initial Catalog=TestMvc;User ID=sa;Password=111111"
 Private Sub quitMenuItem_Click(sender As Object, e As EventArgs) Handles quitMenuItem.Click
  End
 End Sub

 Private Sub selectinfoMenuItem_Click(sender As Object, e As EventArgs) Handles selectinfoMenuItem.Click
  Dim formSearchStudent As New FormSearchStudent
  formSearchStudent.MdiParent = Me
  formSearchStudent.WindowState = FormWindowState.Normal
  formSearchStudent.Show()
 End Sub

 Private Sub updateinfoMenuItem1_Click(sender As Object, e As EventArgs) Handles updateinfoMenuItem1.Click
  Dim formStudentInfo As New FormStudentInfo
  FormSearchStudent.MdiParent = Me
  FormSearchStudent.WindowState = FormWindowState.Normal
  formStudentInfo.Show()
 End Sub

 Private Sub importscoreMenuItem_Click(sender As Object, e As EventArgs) Handles importscoreMenuItem.Click
  Dim formStudentCourse As New FormStudentCourse
  FormSearchStudent.MdiParent = Me
  FormSearchStudent.WindowState = FormWindowState.Normal
  formStudentCourse.Show()
 End Sub

 Private Sub cascadeMenuItem_Click(sender As Object, e As EventArgs) Handles cascadeMenuItem.Click
  Me.LayoutMdi(MdiLayout.Cascade)
 End Sub

 Private Sub horizonMenuItem_Click(sender As Object, e As EventArgs) Handles horizonMenuItem.Click
  Me.LayoutMdi(MdiLayout.TileHorizontal)
 End Sub

 Private Sub verticalMenuItem_Click(sender As Object, e As EventArgs) Handles verticalMenuItem.Click
  Me.LayoutMdi(MdiLayout.TileVertical)

 End Sub

 Private Sub FormStudentSysMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load

 End Sub
End Class

5.FormSearchStudent.vb

Imports System.Data.SqlClient
Public Class FormSearchStudent

 Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click

 End Sub

 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  Dim sqlConStr As String = My.Forms.FormStudentSysMain.DBConnstr
  Dim sqlStr As String = "select * from student "
  Dim sqlDataAdapter As New SqlDataAdapter
  Dim dataSet As New DataSet
  Dim sqlConnection As New SqlConnection(sqlConStr)
  If Trim(txtName.Text) <> "" Then
   sqlStr = sqlStr & "where name like '%" & Trim(txtName.Text) & "%'"
  End If
  sqlDataAdapter.SelectCommand = New SqlCommand(sqlStr, sqlConnection)
  sqlConnection.Open()
  sqlDataAdapter.Fill(dataSet)
  sqlConnection.Close()

  DataGridView1.DataSource = dataSet.Tables(0)



 End Sub

 Private Sub FormSearchStudent_Load(sender As Object, e As EventArgs) Handles MyBase.Load

 End Sub
End Class

6.運(yùn)行結(jié)果

到此這篇關(guān)于淺談如何使用vb.net從數(shù)據(jù)庫中提取數(shù)據(jù)的文章就介紹到這了,更多相關(guān)vb.net從數(shù)據(jù)庫中提取數(shù)據(jù)內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • VB實(shí)現(xiàn)鼠標(biāo)繪圖實(shí)例代碼

    VB實(shí)現(xiàn)鼠標(biāo)繪圖實(shí)例代碼

    這篇文章主要介紹了VB實(shí)現(xiàn)鼠標(biāo)繪圖實(shí)例代碼,很實(shí)用的一個功能,需要的朋友可以參考下
    2014-07-07
  • VB調(diào)用Word拼寫檢查功能實(shí)例

    VB調(diào)用Word拼寫檢查功能實(shí)例

    這篇文章主要介紹了VB調(diào)用Word拼寫檢查功能,非常實(shí)用的功能,需要的朋友可以參考下
    2014-07-07
  • VBA中連接SQLSERVER數(shù)據(jù)庫例子

    VBA中連接SQLSERVER數(shù)據(jù)庫例子

    這篇文章主要介紹了VBA中連接SQLSERVER數(shù)據(jù)庫例子,VBA是指Visual Basic for Applications,是Visual Basic的一種宏語言,需要的朋友可以參考下
    2014-07-07
  • 使用WMI得到計(jì)算機(jī)的信息

    使用WMI得到計(jì)算機(jī)的信息

    WMI是一項(xiàng)行業(yè)推薦規(guī)范,旨在為訪問企業(yè)環(huán)境中的管理信息而開發(fā)一種標(biāo)準(zhǔn)化技術(shù)。該信息包括系統(tǒng)內(nèi)存的狀態(tài)、當(dāng)前安裝的客戶應(yīng)用程序清單,以及有關(guān)客戶端狀態(tài)的其他數(shù)據(jù)
    2019-04-04
  • VB語言使用ADO連接、操作SQLServer數(shù)據(jù)庫教程

    VB語言使用ADO連接、操作SQLServer數(shù)據(jù)庫教程

    這篇文章主要介紹了VB語言使用ADO連接、操作SQLServer數(shù)據(jù)庫教程,本文講解詳細(xì)、代碼中有大量注釋,是非常好的一篇教程,需要的朋友可以參考下
    2014-08-08
  • Basic求10000以內(nèi)的完美數(shù)

    Basic求10000以內(nèi)的完美數(shù)

    一個數(shù)的所有真因數(shù)加起來正好等于這個自然數(shù)本身,在數(shù)學(xué)上,具有這種性質(zhì)的自然數(shù)叫做完全數(shù)。關(guān)鍵是求出該自然數(shù)k的所有因子。如果k%i為0,則i為k的因子,用循環(huán)語句求出k 的所有真因子(1<=i<=k/2),把它們求和,看是否等于k來判斷。
    2015-05-05
  • VB十七種可用一行代碼完成判斷的技巧代碼

    VB十七種可用一行代碼完成判斷的技巧代碼

    這篇文章主要介紹了VB十七種可用一行代碼完成判斷的技巧代碼,需要的朋友可以參考下
    2022-12-12
  • VB實(shí)現(xiàn)的倒計(jì)時(shí)類代碼詳解

    VB實(shí)現(xiàn)的倒計(jì)時(shí)類代碼詳解

    這篇文章主要介紹了VB實(shí)現(xiàn)的倒計(jì)時(shí)類代碼,非常實(shí)用的功能,需要的朋友可以參考下
    2014-07-07
  • VBA中操作Excel常用方法總結(jié)

    VBA中操作Excel常用方法總結(jié)

    這篇文章主要介紹了VBA中操作Excel常用方法總結(jié),包含關(guān)閉工作簿、打開工作簿、切換工作表等,需要的朋友可以參考下
    2014-07-07
  • 分享如何在VB中調(diào)用VC編寫的DLL

    分享如何在VB中調(diào)用VC編寫的DLL

    一般來說,VB和VC共同編程有3種方式:一種是VC生成DLL,在VB中調(diào)用DLL;一種是VC生成ActiveX控件(.ocx),在VB中還有一種是在VC中生成ActiveX Automation服務(wù)器,在VB中調(diào)用
    2013-04-04

最新評論

高要市| 土默特左旗| 仁怀市| 仁化县| 桃源县| 喀喇沁旗| 调兵山市| 德江县| 汉沽区| 旺苍县| 临漳县| 古浪县| 阜阳市| 水富县| 准格尔旗| 徐闻县| 东平县| 阿克陶县| 宜章县| 西畴县| 临夏市| 喀什市| 七台河市| 洛宁县| 滨州市| 永安市| 屯昌县| 定边县| 石渠县| 南昌市| 克拉玛依市| 武邑县| 洛浦县| 祁连县| 石门县| 客服| 米易县| 美姑县| 二手房| 临桂县| 仁寿县|