VB.net做一个小程序 求教 75
请大神帮我看看问题出在哪里?另外我如果要加Button1点击执行结果输出在DataGridView1中应该怎么写?谢谢了,小白求教!~PrivateSubForm1_Lo...
请大神帮我看看问题出在哪里?另外我如果要加Button1点击执行结果输出在DataGridView1中 应该怎么写?谢谢了,小白求教!~ Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim oleDbConnection1 As OleDb.OleDbConnection Dim oledbDataAdapter As OleDb.OleDbDataAdapter Dim oledbData As DataSet = New DataSet Dim strConnect As String = "Provider= OraOLEDB.Oracle;Data Source=888;User ID=888;Password=888;" oleDbConnection1 = New System.Data.OleDb.OleDbConnection(strConnect) Dim strSql As String strSql = "select *" & " from xx" Dim oledbCommand As OleDb.OleDbCommand oledbCommand.CommandText = strSql oledbCommand.CommandType = CommandType.Text oledbCommand.Connection = oleDbConnection1 oledbDataAdapter.SelectCommand = oledbCommand oleDbConnection1.Open() oledbDataAdapter.Fill(oledbData, "gy_bingrenxx") oleDbConnection1.Close() End Sub
展开
展开全部
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim oleDbConnection1 As OleDb.OleDbConnection
Dim oledbDataAdapter As OleDb.OleDbDataAdapter
Dim oledbData As DataSet = New DataSet
Dim strConnect As String = "Provider= OraOLEDB.Oracle;Data Source=888;User ID=888;Password=888;"
oleDbConnection1 = New System.Data.OleDb.OleDbConnection(strConnect)
Dim strSql As String
strSql = "select *" & " from xx"
Dim oledbCommand As OleDb.OleDbCommand
oledbCommand.CommandText = strSql
oledbCommand.CommandType = CommandType.Text
oledbCommand.Connection = oleDbConnection1
oledbDataAdapter.SelectCommand = oledbCommand
oleDbConnection1.Open()
oledbDataAdapter.Fill(oledbData, "gy_bingrenxx")
oleDbConnection1.Close()
'在窗体上添加一个DataGridView控件,在这个位置加一句代码
DataGridView1.DataSource = oledbDataAdapter.Tables("gy_bingrenxx")
End Sub
Dim oleDbConnection1 As OleDb.OleDbConnection
Dim oledbDataAdapter As OleDb.OleDbDataAdapter
Dim oledbData As DataSet = New DataSet
Dim strConnect As String = "Provider= OraOLEDB.Oracle;Data Source=888;User ID=888;Password=888;"
oleDbConnection1 = New System.Data.OleDb.OleDbConnection(strConnect)
Dim strSql As String
strSql = "select *" & " from xx"
Dim oledbCommand As OleDb.OleDbCommand
oledbCommand.CommandText = strSql
oledbCommand.CommandType = CommandType.Text
oledbCommand.Connection = oleDbConnection1
oledbDataAdapter.SelectCommand = oledbCommand
oleDbConnection1.Open()
oledbDataAdapter.Fill(oledbData, "gy_bingrenxx")
oleDbConnection1.Close()
'在窗体上添加一个DataGridView控件,在这个位置加一句代码
DataGridView1.DataSource = oledbDataAdapter.Tables("gy_bingrenxx")
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询