时间:2021-05-19
1.设置从Model中的Sub Main 启动
2.程序结构
3.Model1
Imports System.Windows.Forms.ApplicationModule Module1 Sub Main() 'form1 是测试多文档窗口 'Dim frm1 As New Form1() 'frm1.Show() Dim formStudentSysMain As New FormStudentSysMain() formStudentSysMain.Show() Do While True DoEvents() Loop End SubEnd Module4.FormStudentSysMain.vb
Imports System.Data.SqlClientPublic 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 SubEnd Class5.FormSearchStudent.vb
Imports System.Data.SqlClientPublic 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 SubEnd Class6.运行结果
到此这篇关于浅谈如何使用vb.net从数据库中提取数据的文章就介绍到这了,更多相关vb.net从数据库中提取数据内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
当我们用JDBC或者数据源,从数据库中提取数据的时候,往往会出现乱码问题。这主要是因为我们使用的数据库编码可能与我们网页使用的编码不一致,导致我们从数据库中提取
vbnet和vb的区别是vbnet数据库应用包括ADO.net、数据绑定;vb数据库应用包括ADO、DAO;和vb相比,vbnet是完全面向对象的编程语句;vb
一、VB数据库的体系结构具体的VB的数据库结构。VB数据库的核心结构是所谓的MicroSoftJET数据库引擎,JET引擎的作用就像是一块"面板",在其上可以插
一个简单的自动发送邮件系统(三)这里介绍php和mysql结合起来实用。如何从mysql数据库中提取数据。好,我们已经成功的完成了我们的要求,很多的数据已经存在
本文分步介绍了如何通过使用ADO.NET和VisualC#.NET来创建MicrosoftSQLServer数据库,这是因为程序员通常需要以编程方式创建数据库。