如何在VB从sql 中读取数据 (初学者跪求)
展开全部
vb.net
'命名空间
Imports System.Data
Imports System.Data.SqlClient
'定义变量
'连接数据库
Dim connstr As String = System.Configuration.ConfigurationSettings.AppSettings("connstr")
Dim sql_conn As New SqlConnection(connstr)
‘读取SQL数据到视图view1
public sub getdate()
Dim g_ap As New SqlDataAdapter("select * from tb1", sql_conn)
Dim g_d As New DataSet
g_ap.Fill(g_d)
view1.AutoGenerateColumns = False
view1.DataSource = g_d.Tables(0)
sub
'命名空间
Imports System.Data
Imports System.Data.SqlClient
'定义变量
'连接数据库
Dim connstr As String = System.Configuration.ConfigurationSettings.AppSettings("connstr")
Dim sql_conn As New SqlConnection(connstr)
‘读取SQL数据到视图view1
public sub getdate()
Dim g_ap As New SqlDataAdapter("select * from tb1", sql_conn)
Dim g_d As New DataSet
g_ap.Fill(g_d)
view1.AutoGenerateColumns = False
view1.DataSource = g_d.Tables(0)
sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询