Imports System.Data
Imports System.Data.SqlClient
Public Class Form2
Dim Conn As SqlConnection = New SqlConnection
Dim da As SqlDataAdapter
Dim dt As New DataTable
Private bin As New BindingSource
Dim CurrentRecord As Integer
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strConn As String
strConn = "Data Source=.\SQLEXPRESS;Initial Catalog=SSPEGIS;Integrated Security=True"
Conn = New SqlConnection(strConn)
Dim sqlland As String = ""
sqlland = "SELECT * FROM land ORDER BY LANDID"
da = New SqlDataAdapter(sqlland, Conn)
da.Fill(dt)
Dim cmb As SqlCommandBuilder
cmb = New SqlCommandBuilder(da)
bin.DataSource = dt
Try
If Convert.ToString(dt.Rows(CurrentRecord).Item("PICTURE")) <> "" Then
PictureBox1.Image = Image.FromFile(Convert.ToString(dt.Rows(CurrentRecord).Item("PICTURE")))
Else
PictureBox1.Image = Nothing
End If
Catch
PictureBox1.Image = Nothing
End Try
End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
bin.Position += 1
If bin.Current("PICTURE") Then
End If
End Sub
End Class
Tag : .NET, Ms SQL Server 2008, Win (Windows App), VS 2010 (.NET 4.x)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
bin.Position += 1
If bin.Current("PICTURE") Then
End If
End Sub