V
Vishruth Ranjit
Would anyone of you could please help me in solving this
problem.Please.
Public Class Form1
Inherits System.Windows.Forms.Form
Dim CN As New ADODB.Connection
Dim RS As New ADODB.Recordset
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form
Designer.
InitializeComponent()
'Add any initialization after the
InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal
disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the
Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5,
13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Name = "Form1"
Me.Text = "Form1"
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Me.CN.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=D:\Documents and
Settings\rvish\Desktop\db1.mdb;Persist Security
Info=False")
Dim SQLStr As String = "Select * From NODE_1"
Dim CMD As New OleDb.OleDbCommand(SQLStr, CN)
RS.Open(CMD, SQLStr,
ADODB.CursorTypeEnum.adOpenKeyset,
ADODB.LockTypeEnum.adLockOptimistic)
Dim blackPen As New Pen(Color.Black, 10)
' Draw line to screen.
Dim g As Graphics = Me.CreateGraphics()
Dim lastX, lastY As Integer
Dim RDR = CMD.ExecuteReader()
' Always call Read before accessing data.
While RDR.Read()
g.DrawLine(blackPen, lastX, lastY, RDR.GetInt32
(0), RDR.GetInt32(1))
lastX = RDR.GetInt32(0)
lastY = RDR.GetInt32(1)
End While
' always call Close when done reading.
RDR.Close()
' Close the connection when done with it.
CN.Close()
End Sub
End Class
Actually in this case I have two field X and Y
and struggling to plot the coordinates on my form.My
database is Access.Trying to retrieve about 50 record from
my database(Access).Please find my error commited.
Thanking you.
problem.Please.
Public Class Form1
Inherits System.Windows.Forms.Form
Dim CN As New ADODB.Connection
Dim RS As New ADODB.Recordset
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form
Designer.
InitializeComponent()
'Add any initialization after the
InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal
disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the
Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5,
13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Name = "Form1"
Me.Text = "Form1"
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Me.CN.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=D:\Documents and
Settings\rvish\Desktop\db1.mdb;Persist Security
Info=False")
Dim SQLStr As String = "Select * From NODE_1"
Dim CMD As New OleDb.OleDbCommand(SQLStr, CN)
RS.Open(CMD, SQLStr,
ADODB.CursorTypeEnum.adOpenKeyset,
ADODB.LockTypeEnum.adLockOptimistic)
Dim blackPen As New Pen(Color.Black, 10)
' Draw line to screen.
Dim g As Graphics = Me.CreateGraphics()
Dim lastX, lastY As Integer
Dim RDR = CMD.ExecuteReader()
' Always call Read before accessing data.
While RDR.Read()
g.DrawLine(blackPen, lastX, lastY, RDR.GetInt32
(0), RDR.GetInt32(1))
lastX = RDR.GetInt32(0)
lastY = RDR.GetInt32(1)
End While
' always call Close when done reading.
RDR.Close()
' Close the connection when done with it.
CN.Close()
End Sub
End Class
Actually in this case I have two field X and Y
and struggling to plot the coordinates on my form.My
database is Access.Trying to retrieve about 50 record from
my database(Access).Please find my error commited.
Thanking you.