简单操作DB2
CODE:
1
Imports System.Data
2
Imports System.Data.OleDb
3
4
Public Class Form1
5
6
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
7
Dim conn As New OleDbConnection("Provider=IBMDADB2.1;Password=admindb2;Persist Security Info=True;User ID=db2admin;Data Source=mydb2;Location=192.0.3.44;Extended Properties=")
8
conn.Open()
9
Dim cmd As OleDbCommand = conn.CreateCommand
10
cmd.CommandText = "select * from mydt order by uid desc fetch first 1 rows only"
11
Dim dr As OleDbDataReader = cmd.ExecuteReader()
12
While dr.Read()
13
Me.Button1.Text = dr("uname").ToString + "/" + dr("upwd").ToString
14
End While
15
dr.Close()
16
conn.Close()
17
End Sub
18
End Class
Imports System.Data2
Imports System.Data.OleDb3

4
Public Class Form15

6
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click7
Dim conn As New OleDbConnection("Provider=IBMDADB2.1;Password=admindb2;Persist Security Info=True;User ID=db2admin;Data Source=mydb2;Location=192.0.3.44;Extended Properties=")8
conn.Open()9
Dim cmd As OleDbCommand = conn.CreateCommand10
cmd.CommandText = "select * from mydt order by uid desc fetch first 1 rows only"11
Dim dr As OleDbDataReader = cmd.ExecuteReader()12
While dr.Read()13
Me.Button1.Text = dr("uname").ToString + "/" + dr("upwd").ToString14
End While15
dr.Close()16
conn.Close()17
End Sub18
End ClassSHOW:


浙公网安备 33010602011771号