标题:请帮忙看一下,代码借在哪里!百思不得解啊,关于VB连接SQL数据库的问题
只看楼主
feishi1985
Rank: 2
等 级:论坛游民
帖 子:23
专家分:50
注 册:2011-11-29
结帖率:0
 问题点数:0 回复次数:0 
请帮忙看一下,代码借在哪里!百思不得解啊,关于VB连接SQL数据库的问题
Dim objConnection As New SqlConnection("Server=localhost;database=student;user=sa;password=123456")
    Dim objDataAdapter As New SqlDataAdapter()
    Dim objDataSet As New DataSet()

    Private Sub Form1_Click(sender As Object, e As EventArgs) Handles Me.Click
        objDataAdapter.SelectCommand = New SqlCommand()
        objDataAdapter.SelectCommand.Connection = objConnection
        objDataAdapter. = CommandType.Text
        objDataAdapter. = "select * from st_information"
        objConnection.Open()
        objDataAdapter.Fill(objDataSet, "st_information")
        objConnection.Close()
        grdStudent.AutoGenerateColumns = True
        grdStudent.DataSource = objDataSet
        grdStudent.DataMember = "student information"
        objDataAdapter = Nothing
        objDataSet = Nothing

    End Sub
搜索更多相关主题的帖子: localhost SQL数据库 password database Object 
2015-03-04 21:44



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-442367-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.300188 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved