Sunday, November 8, 2009

VB.NET 2008 DATA PROGRAMMING WITH CRYSTAL REPORT



VB.NET 2008 DATA PROGRAMMING WITH CRYSTAL REPORT

image0014









DataSet and DataAdapter in ASP.NET 2.0 - Part 1 of 2
What are DataSets and DataAdapters
Datasets store a copy of data from the database tables. However, Datasets can not directly retrieve data from Databases. DataAdapters are used to link Databases with DataSets. If we see diagrammatically,
DataSets < ----- DataAdapters < ----- DataProviders < ----- Databases
DataSets and DataAdapters are used to display and manipulate data from databases.
Reading Data into a Dataset
To read data into Dataset, you need to:
Create a database connection and then a dataset object.
Create a DataAdapter object and refer it to the DB connection already created. Note that every DataAdapter has to refer to a connection object. For example, SqlDataAdapter refers to SqlDataConnection.
The Fill method of DataAdapter has to be called to populate the Dataset object.
We elaborate the above mentioned steps by giving examples of how each step can be performed:

1) As we said, our first task is to create a connection to database. We would explore later that there is no need of opening and closing database connection explicitly while you deal with DataAdapter objects. All you have to do is, create a connection to database using the code like this:
___________________________________


Public Class Form1
Dim conn As New OleDb.OleDbConnection
Dim adp As New OleDb.OleDbDataAdapter("select * from EMP", conn)
Dim row As DataRow
Dim bm As BindingManagerBase
Dim dset As New DataSet

Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\EMP.mdb" & """"
Try
conn.Open()
' Insert code to process data.
Catch ex As Exception
MessageBox.Show("Failed to connect to data source" + ex.ToString)
Finally
conn.Close()
End Try
adp.Fill(dset, "EMP")
'row = dset.Tables("EMP").Rows(0)
row = dset.Tables("EMP").Rows(dset.Tables("EMP").Rows.Count - 1)
TextBox1.Text = row(0).ToString
TextBox2.Text = row(1).ToString

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
i = TextBox1.Text
If i = 1 Then
MessageBox.Show("Beginning Point of Record")
Else
i -= 1
Try
row = dset.Tables("EMP").Rows(i - 1)
TextBox1.Text = row(0).ToString
TextBox2.Text = row(1).ToString
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End If


End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim i As Integer
i = TextBox1.Text
If i = dset.Tables("EMP").Rows.Count Then
MessageBox.Show("End Point of Record")
Else
i += 1
Try
row = dset.Tables("EMP").Rows(i - 1)
TextBox1.Text = row(0).ToString
TextBox2.Text = row(1).ToString
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End If
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Try
row = dset.Tables("EMP").Rows(0)
TextBox1.Text = row(0).ToString
TextBox2.Text = row(1).ToString
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Try
row = dset.Tables("EMP").Rows(dset.Tables("EMP").Rows.Count - 1)
TextBox1.Text = row(0).ToString
TextBox2.Text = row(1).ToString
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim par As String
par = "INSERT INTO EMP" + "(" + "ID, NAME" + ") " + "VALUES" + "( " + "'" + TextBox1.Text + "'" + ", " + "'" + TextBox2.Text + "'" + ");"
MessageBox.Show(par)
Dim cmd As New OleDb.OleDbCommand(par, conn)
cmd.CommandType = CommandType.Text
adp.SelectCommand = cmd
adp.Fill(dset, "EMP")
row = dset.Tables("EMP").Rows(dset.Tables("EMP").Rows.Count - 1)
TextBox1.Text = row(0).ToString
TextBox2.Text = row(1).ToString
End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
TextBox1.Text = ""
TextBox2.Text = ""
End Sub
End Class





to know total row in this table :
MessageBox.Show(dset.Tables("EMP").Rows.Count)



_______________________________-
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim conn As New OleDb.OleDbConnection
Dim dset As New DataSet
Dim constr1 As String
constr1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Str("\") + "C:\Documents and Settings\admin\My Documents\EMP.mdb" + Str("\")
conn.ConnectionString = constr1
MessageBox.Show(conn.ConnectionString)
Try
conn.Open()
' Insert code to process data.

Dim adp As New OleDb.OleDbDataAdapter("select * from EMP", conn)
adp.Fill(dset, "EMP")
Dim row As DataRow
row = dset.Tables("EMP").Rows(0)
TextBox1.Text = row(0)(0).ToString
TextBox2.Text = row(0)(1).ToString
Catch ex As Exception
MessageBox.Show("Failed to connect to data source" + ex.ToString)

Finally
conn.Close()
End Try
End Sub
End Class
________________________________________________________________________

SqlConnection con = new SqlConnection ("data source=localhost; uid= sa; pwd= abc; database=Northwind");

We would use Northwind database by using OleDbConnection. The Code would

Look like:

OleDbConnection con= new OleDbConnection ("Provider =Microsoft.JET.OLEDB.4.0;" + "Data Source=C:\\Program Files\\Microsoft Office\\Office\\Samples\\Northwind.mdb");

2) Now, create a Dataset object which would be used for storing and manipulating data. You would be writing something like

DataSet myDataSet = new DataSet ("Northwind");

Since the name of source database is Northwind, we have passed the same name in the constructor.

3) The DataSet has been created but as we said before, this DataSet object can not directly interact with Database. We need to create a DataAdapter object which would refer to the connection already created. The following line would declare a DataAdapter object:

OleDbAdapter myDataAdapter = new OleDbAdapter (CommandObject, con);

The above line demonstrates one of many constructors of OleDbAdapter class. This constructor takes a command object and a database connection object. The purpose of command object is to retrieve suitable data needed for populating DataSet. As we know SQL commands directly interacting with database tables, a similar command can be assigned to CommandObject.

OleDbCommand CommandObject = new OleDbCommand ("Select * from employee");

Whatever data you need for your Dataset should be retrieved by using suitable command here. The second argument of OleDbAdapter constructor is connection object con.

Alternative approach for initializing DataAdapter object:

Place a null instead of CommandObject while you initialize the OleDbAdapter object:

OleDbAdapter myDataAdapter = new OleDbAdapter (null, con);

Then you assign your query to the CommandObject and write:

myDataAdapter.SelectCommand = CommandObject;

4) Now, the bridge between the DataSet and Database has been created. You can populate dataset by using the Fill command:

myDataAdapter.Fill (myDataSet, "EmployeeData");

The first argument to Fill function is the DataSet name which we want to populate. The second argument is the name of DataTable. The results of SQL queries go into DataTable. In this example, we have created a DataTable named EmployeeData and the values in this table would be the results of SQL query: "Select * from employee". In this way, we can use a dataset for storing data from many database tables.

5) DataTables within a Dataset can be accessed using Tables. To access EmployeeData, we need to write:

myDataSet.Tables["EmployeeData"].
To access rows in each Data Table, you need to write:

myDataSet.Tables["EmployeeData].Rows
___________________________________________________________________
OleDbConnection con= new OleDbConnection ("Provider =Microsoft.JET.OLEDB.4.0;" + "Data Source=C:\\Program Files\\Microsoft Office\\Office\\Samples\\Northwind.mdb");

OleDbCommand CommandObject = new OleDbCommand ("Select * from employee");

OleDbAdapter myDataAdapter = new OleDbAdapter (CommandObject, con);

//DataSet myDataSet = new DataSet ("Northwind");
myDataAdapter.Fill (myDataSet, "EmployeeData");

Place a null instead of CommandObject while you initialize the OleDbAdapter object:

OleDbAdapter myDataAdapter = new OleDbAdapter (null, con);

Then you assign your query to the CommandObject and write:

myDataAdapter.SelectCommand = CommandObject;
________________________________________________
Listing 1.1 would combine all the steps we have elaborated so far.



1. <%@ Page Language= "C#" %>

2. <%@ Import Namespace= "System.Data" %>

3. <%@ Import Namespace= "System.Data.OleDb" %>

4.

5.

6.

7.

8.

9.

10.

11.

12.

13. <% OleDbConnection con= new OleDbConnection ("Provider

14. =Microsoft.JET.OLEDB.4.0;" + "Data Source=C:\\Program Files\\Microsoft

15. Office\\Office\\Samples\\Northwind.mdb");

16.

17. <%

18. DataSet myDataSet = new DataSet();

19. OleDbCommand CommandObject = new OleDbCommand ("Select * from

20. employee");

21.

22. OleDbAdapter myDataAdapter = new OleDbAdapter (CommandObject, con);

23.

24. myDataAdapter.Fill (myDataSet, "EmployeeData");

25.

26. foreach (DataRow dr in myDataSet.Tables["EmployeeData"].Rows)

27. {

28. Response.write ("");

29. for (int j = 0 ; j <2 ; j++)

30. {

31. Response.write ( "");

34.

35. %>

36.
Employee ID Employee Name
" + dr[j].ToString() + " );

32. }

33. Response.write ("


37.

38.



The Code above would iterate in all rows of Employee table and display ID and name of every employee. To Display all columns of Employee Table, Line # 29 would be replaced by:



for (int j = 0 ; j < dr.Table.Columns.Count ; j++)



As we said earlier, there is no need of opening and closing database connection explicitly. DataAdapter class handles both these functions.

____________________________________________________________________
Deletions in Employee Table
To delete the Employee having id 1001:



1. int i =0;

2. foreach (DataRow dr in ds1.Tables["EmployeeData"].Rows)

3. {

4. i++;

5. if (dr["id"] = = 1001 )

6. break;

7. }

8. EmployeeData.Rows[i].Delete;

____________________________________
Updating Employee Table
To change the name of Employee having id 1001:



8. foreach (DataRow dr in ds1.Tables["EmployeeData"].Rows)

9. if (dr["id"] = = 1001 )

10. dr["name"] = "new name";

__________________________________________
Insertions in Employee Table


1. DataRow dr = EmployeeData.NewRow();

2. dr["id"] = "1003";

3. dr["name"] = "Ahmed Albaradi";

(or you can move it like dr[0], dr[1],a., dr[n-1])

4. EmployeeData.Rows.Add(dr);

_______________________________________________
Writing Changes back to database table
We have discussed that DataSets can not directly interact with Database tables. Moreover, all the modifications we performed above apply only to EmployeeData, which is Data Table. Before we discuss how to write back changes, letAs explore DataAdapter class in a bit more detail:

We have discussed SelectCommand property which lets the Adapter selects its query. There are three other properties including UpdateCommand, AddCommand and DeleteCommand. All these commands would make changes in the database. However, by using CommandBuilderObject, you donAt have to create all the available commands. The update, Add and Delete commands are created automatically based on SelectCommand.

OleDbCommandBuilder mybuilder = new OleDbCommandBuilder (myDataAdapter);

And after writing this statement, you are now in position to make changes back to database. All you have to do is create a separate dataset for all the modified rows and then apply the Update command of DataAdapter.

1. DataSet newSet = myDataSet.GetChanges (DataRowState.Modified);

2. myDataAdapter.Update(newSet, "EmployeeData");

GetChanges method would return all the modified rows .The parameter in GetChanges method can be different. For example:

DataRowState.Added: would return newly added rows

DataRowState.Deleted: would return deleted rows

_____________________________________________________
THIS IS ORIGINAL:

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Data
Public Class Form1
Dim conn As New OleDb.OleDbConnection
Dim adp As New OleDb.OleDbDataAdapter("select * from EMP", conn)
Dim row As DataRow
Dim i As Integer
Dim cmd As OleDb.OleDbCommand
Dim dset As New DataSet


Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\EMP.mdb" & """"
Try
conn.Open()
Catch ex As Exception
MessageBox.Show("Failed to connect to data source: " + ex.ToString)
Finally
conn.Close()
End Try
adp.Fill(dset, "EMP")
row = dset.Tables("EMP").Rows(dset.Tables("EMP").Rows.Count - 1)
TextBox1.Text = row(0).ToString
TextBox2.Text = row(1).ToString
i = dset.Tables("EMP").Rows.Count - 1
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If i = 0 Then
MessageBox.Show("Beginning Point of Record")
Else
i -= 1
Try
row = dset.Tables("EMP").Rows(i)
TextBox1.Text = row(0).ToString
TextBox2.Text = row(1).ToString
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End If

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

If i = dset.Tables("EMP").Rows.Count Then
MessageBox.Show("End Point of Record")
Else
i += 1
Try
row = dset.Tables("EMP").Rows(i - 1)
TextBox1.Text = row(0).ToString
TextBox2.Text = row(1).ToString
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End If
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

Try
row = dset.Tables("EMP").Rows(0)
TextBox1.Text = row(0).ToString
TextBox2.Text = row(1).ToString
i = 0
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Try
row = dset.Tables("EMP").Rows(dset.Tables("EMP").Rows.Count - 1)
TextBox1.Text = row(0).ToString
TextBox2.Text = row(1).ToString
i = dset.Tables("EMP").Rows.Count - 1
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim par As String
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MessageBox.Show(" PLEASE ENTER DATA BEFORE ADD")
Exit Sub
End If

par = "INSERT INTO EMP VALUES('" & TextBox1.Text & "','" & TextBox2.Text & "')"
Dim cmd As New OleDb.OleDbCommand(par, conn)
Try
cmd.CommandType = CommandType.Text
adp.SelectCommand = cmd
adp.Fill(dset, "EMP")
conn.Close()
Catch ex As Exception
MessageBox.Show("Either Duplicate ID or Bad Data have entered, cann't added")
End Try
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\EMP.mdb" & """"
Try
conn.Open()
par = "SELECT * FROM EMP"
cmd.CommandText = par
adp.SelectCommand = cmd
adp.Fill(dset, "EMP")
row = dset.Tables("EMP").Rows(dset.Tables("EMP").Rows.Count - 1)
TextBox1.Text = row(0).ToString
TextBox2.Text = row(1).ToString
Catch ex As Exception
MessageBox.Show("Failed to connect to data source: " + ex.ToString)
Finally
conn.Close()
End Try

End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
TextBox1.Text = ""
TextBox2.Text = ""
End Sub


Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim par As String
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MessageBox.Show(" PLEASE ENTER DATA BEFORE ADD")
Exit Sub
End If

par = "UPDATE EMP SET NAME='" & TextBox2.Text & "'" & " WHERE ID=" & TextBox1.Text
Dim cmd As New OleDb.OleDbCommand(par, conn)
Try
cmd.CommandType = CommandType.Text
adp.SelectCommand = cmd
adp.Fill(dset, "EMP")
conn.Close()
Catch ex As Exception
MessageBox.Show("Either Duplicate ID or Bad Data have entered, cann't added")
End Try
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\EMP.mdb" & """"
Try
conn.Open()
par = "SELECT * FROM EMP"
cmd.CommandText = par
adp.SelectCommand = cmd
adp.Fill(dset, "EMP")
row = dset.Tables("EMP").Rows(dset.Tables("EMP").Rows.Count - 1)
TextBox1.Text = row(0).ToString
TextBox2.Text = row(1).ToString
Catch ex As Exception
MessageBox.Show("Failed to connect to data source: " + ex.ToString)
Finally
conn.Close()
End Try
End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Dim par As String
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MessageBox.Show(" PLEASE ENTER DATA BEFORE ADD")
Exit Sub
End If

par = "UPDATE EMP SET NAME='" & TextBox2.Text & "'" & " WHERE ID=" & TextBox1.Text
Dim cmd As New OleDb.OleDbCommand(par, conn)
Try
cmd.CommandType = CommandType.Text
adp.SelectCommand = cmd
adp.Fill(dset, "EMP")
conn.Close()
Catch ex As Exception
MessageBox.Show("Either Duplicate ID or Bad Data have entered, cann't added")
End Try
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\EMP.mdb" & """"
Try
conn.Open()
par = "SELECT * FROM EMP"
cmd.CommandText = par
adp.SelectCommand = cmd
adp.Fill(dset, "EMP")
row = dset.Tables("EMP").Rows(dset.Tables("EMP").Rows.Count - 1)
TextBox1.Text = row(0).ToString
TextBox2.Text = row(1).ToString
Catch ex As Exception
MessageBox.Show("Failed to connect to data source: " + ex.ToString)
Finally
conn.Close()
End Try
End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim par As String
par = "DELETE FROM EMP WHERE ID=" & TextBox1.Text
Dim cmd As New OleDb.OleDbCommand(par, conn)
Try
cmd.CommandType = CommandType.Text
adp.SelectCommand = cmd
adp.Fill(dset, "EMP")
conn.Close()
Catch ex As Exception
MessageBox.Show("Either Duplicate ID or Bad Data have entered, cann't added")
End Try
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\EMP.mdb" & """"
Try
conn.Open()
par = "SELECT * FROM EMP"
cmd.CommandText = par
adp.SelectCommand = cmd
adp.Fill(dset, "EMP")
row = dset.Tables("EMP").Rows(dset.Tables("EMP").Rows.Count - 1)
TextBox1.Text = row(0).ToString
TextBox2.Text = row(1).ToString
Catch ex As Exception
MessageBox.Show("Failed to connect to data source: " + ex.ToString)
Finally
conn.Close()
End Try
End Sub

Private Sub Button9_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
'Dim CR As New CrystalReport1
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\EMP.mdb" & """"
Dim query As String
conn.Open()
Dim adp As New OleDb.OleDbDataAdapter("select * from EMP", conn)
Try
Dim d As New ReportDocument
d.Load("C:\EMP\EMP\CrystalReport1.rpt")
adp.Fill(dset, "EMP")
d.SetDataSource(dset)
'CR.SetDataSource(dset)
query = "{EMP.NAME} ='" & TextBox2.Text & "'"
CrystalReportViewer1.SelectionFormula = query
CrystalReportViewer1.ReportSource = d
'CrystalReportViewer1.ReportSource = CR
CrystalReportViewer1.Refresh()
Catch ex As Exception
MessageBox.Show(ex.ToString)
Finally
conn.Close()
End Try


End Sub

End Class


______________________________ALL RIGHT______________________________________
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Data
Public Class Form1
Dim conn As New OleDb.OleDbConnection
Dim row As DataRow
Dim dset As New DataSet
Dim adp As New OleDb.OleDbDataAdapter("select * from LAND", conn)
Dim i As Integer
Dim c As Integer
Dim cmd As OleDb.OleDbCommand

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\LAND.mdb" & """"
Try
conn.Open()
Catch ex As Exception
MessageBox.Show("Failed to connect to data source: " + ex.ToString)
Finally
conn.Close()
End Try
adp.Fill(dset, "LAND")
row = dset.Tables("LAND").Rows(dset.Tables("LAND").Rows.Count - 1)
Text1.Text = row(1).ToString
Text2.Text = row(5).ToString
Text3.Text = row(2).ToString
Text4.Text = row(6).ToString
Text5.Text = row(3).ToString
Text6.Text = row(7).ToString
Text7.Text = row(4).ToString
Text8.Text = row(8).ToString
Text9.Text = row(0).ToString
Text10.Text = row(9).ToString
i = dset.Tables("LAND").Rows.Count - 1
GroupBox1.Show()
GroupBox2.Hide()
Label3.ForeColor = Color.Red
Label3.Text = Now()
Timer1.Start()
TabControl1.Hide()
Label18.Visible = False
Button3.Hide()
Button4.Hide()
Button5.Hide()
End Sub


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox1.Text = "land" Then
If MaskedTextBox1.Text = "land123" Then
MessageBox.Show("login successfully!")
GroupBox1.Hide()
GroupBox2.Show()
Label3.ForeColor = Color.Green
Me.Height = 323
Button6.Show()
Button3.Show()
Button4.Show()
Button5.Show()
TextBox1.Text = ""
MaskedTextBox1.Text = ""
Else
MessageBox.Show("Incorrect Password!")
MaskedTextBox1.Text = ""
End If
Else
MessageBox.Show("Incorrect User ID !")
TextBox1.Text = ""
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
conn.Close()
End
End Sub

Public Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label3.Text = Now()
Label17.Text = Now()
Label18.Text = Now()
Label21.Text = Now()
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Button6.Hide()
Button3.Hide()
Button4.Hide()
Button5.Hide()
GroupBox2.Hide()
GroupBox1.Show()
Label3.ForeColor = Color.Red
Me.Height = 457
c = 0
End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
TabControl1.Hide()
Me.Height = 323
dset.Clear()
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\LAND.mdb" & """"
Try
conn.Open()
Catch ex As Exception
MessageBox.Show("Failed to connect to data source: " + ex.ToString)
Finally
conn.Close()
End Try
adp.Fill(dset, "LAND")
row = dset.Tables("LAND").Rows(dset.Tables("LAND").Rows.Count - 1)
Text1.Text = row(1).ToString
Text2.Text = row(5).ToString
Text3.Text = row(2).ToString
Text4.Text = row(6).ToString
Text5.Text = row(3).ToString
Text6.Text = row(7).ToString
Text7.Text = row(4).ToString
Text8.Text = row(8).ToString
Text9.Text = row(0).ToString
Text10.Text = row(9).ToString
i = dset.Tables("LAND").Rows.Count - 1
End Sub

Private Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
TabControl1.Show()
Me.Height = 486
Label21.Visible = True
Label18.Visible = True
c = 0
End Sub
Private Sub Button4_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
TabControl1.Show()
Me.Height = 486
Label21.Visible = True
Label18.Visible = True
c = 0
End Sub

Private Sub Button5_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
TabControl1.Show()
Me.Height = 486
Label21.Visible = True
Label18.Visible = True
c = 0
End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
TabControl1.Hide()
Me.Height = 323
dset.Clear()
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\LAND.mdb" & """"
Try
conn.Open()
Catch ex As Exception
MessageBox.Show("Failed to connect to data source: " + ex.ToString)
Finally
conn.Close()
End Try
adp.Fill(dset, "LAND")
row = dset.Tables("LAND").Rows(dset.Tables("LAND").Rows.Count - 1)
Text1.Text = row(1).ToString
Text2.Text = row(5).ToString
Text3.Text = row(2).ToString
Text4.Text = row(6).ToString
Text5.Text = row(3).ToString
Text6.Text = row(7).ToString
Text7.Text = row(4).ToString
Text8.Text = row(8).ToString
Text9.Text = row(0).ToString
Text10.Text = row(9).ToString
i = dset.Tables("LAND").Rows.Count - 1
End Sub


Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
Dim par As String
Dim dt As DataTable
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\LAND.mdb" & """"
conn.Open()
If ComboBox1.Text = "PLOT_NO" Or ComboBox1.Text = "AREA" Then
par = "SELECT * FROM LAND WHERE " & ComboBox1.Text & " = " & TextBox12.Text
Else
par = "SELECT * FROM LAND WHERE " & ComboBox1.Text & " = '" & TextBox12.Text & "'"
End If
Dim adp As New OleDb.OleDbDataAdapter(par, conn)
Try
dset.Clear()
adp.Fill(dset, "LAND")
row = dset.Tables("LAND").Rows(dset.Tables("LAND").Rows.Count - 1)
dt = dset.Tables("LAND")
If dt.Rows.Count > 1 Then
TextBox14.Text = dt.Rows.Count
Label23.Text = " ROWS ARE AVAILABLE"
Button22.Enabled = True
Button23.Enabled = True
Button24.Enabled = True
Button25.Enabled = True
Else
TextBox14.Text = dt.Rows.Count
Label23.Text = " ROW IS AVAILABLE"
Button22.Enabled = False
Button23.Enabled = False
Button24.Enabled = False
Button25.Enabled = False
End If
TextBox2.Text = row(1).ToString
TextBox3.Text = row(5).ToString
TextBox4.Text = row(2).ToString
TextBox5.Text = row(6).ToString
TextBox6.Text = row(3).ToString
TextBox7.Text = row(7).ToString
TextBox8.Text = row(4).ToString
TextBox9.Text = row(8).ToString
TextBox10.Text = row(0).ToString
TextBox11.Text = row(9).ToString
Catch ex As Exception
MessageBox.Show("WRONG VALUE WAS ENTERED")
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
TextBox11.Text = ""
TextBox14.Text = 0
Label23.Text = " ROWS ARE AVAILABLE"
Button22.Enabled = False
Button23.Enabled = False
Button24.Enabled = False
Button25.Enabled = False
Finally
conn.Close()
End Try
End Sub

Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
TabControl1.Hide()
Me.Height = 323
dset.Clear()
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\LAND.mdb" & """"
Try
conn.Open()
Catch ex As Exception
MessageBox.Show("Failed to connect to data source: " + ex.ToString)
Finally
conn.Close()
End Try
adp.Fill(dset, "LAND")
row = dset.Tables("LAND").Rows(dset.Tables("LAND").Rows.Count - 1)
Text1.Text = row(1).ToString
Text2.Text = row(5).ToString
Text3.Text = row(2).ToString
Text4.Text = row(6).ToString
Text5.Text = row(3).ToString
Text6.Text = row(7).ToString
Text7.Text = row(4).ToString
Text8.Text = row(8).ToString
Text9.Text = row(0).ToString
Text10.Text = row(9).ToString
i = dset.Tables("LAND").Rows.Count - 1
End Sub

Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
Dim par As String
Dim CR As New CrystalReport1
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\LAND.mdb" & """"
conn.Open()
If ComboBox2.Text = "PLOT_NO" Or ComboBox2.Text = "AREA" Then
par = "SELECT * FROM LAND WHERE " & ComboBox2.Text & " = " & TextBox13.Text
Else
par = "SELECT * FROM LAND WHERE " & ComboBox2.Text & " = '" & TextBox13.Text & "'"
End If
Dim adp As New OleDb.OleDbDataAdapter(par, conn)
Try
dset.Clear()
adp.Fill(dset, "LAND")
CR.SetDataSource(dset)
CrystalReportViewer1.ReportSource = CR
CrystalReportViewer1.Refresh()
Catch ex As Exception
MessageBox.Show("WRONG VALUE WAS ENTERED")
Finally
conn.Close()
End Try

End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
Dim par As String
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\LAND.mdb" & """"
conn.Open()
If TextBox10.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Or TextBox5.Text = "" Or TextBox6.Text = "" Or TextBox7.Text = "" Or TextBox8.Text = "" Or TextBox9.Text = "" Or TextBox10.Text = "" Or TextBox11.Text = "" Then
MessageBox.Show("Enter Plot No. and other details Before Edition!")
conn.Close()
Else
par = "UPDATE LAND SET DEPARTMENT ='" & TextBox2.Text & "', BLOCK ='" & TextBox4.Text & "', LOCATION ='" & TextBox6.Text & "', RVENUE_CIRCLE ='" & TextBox8.Text & "', AREA =" & TextBox3.Text & ", STATUS ='" & TextBox5.Text & "', DEMARCATED_FENCED ='" & TextBox7.Text & "', STRUCTURE ='" & TextBox9.Text & "', REMARKS ='" & TextBox11.Text & "'" & " WHERE PLOT_NO =" & TextBox10.Text
Dim adp As New OleDb.OleDbDataAdapter(par, conn)
Try
adp.Fill(dset, "LAND")
row = dset.Tables("LAND").Rows(dset.Tables("LAND").Rows.Count - 1)
TextBox2.Text = row(1).ToString
TextBox3.Text = row(5).ToString
TextBox4.Text = row(2).ToString
TextBox5.Text = row(6).ToString
TextBox6.Text = row(3).ToString
TextBox7.Text = row(7).ToString
TextBox8.Text = row(4).ToString
TextBox9.Text = row(8).ToString
TextBox10.Text = row(0).ToString
TextBox11.Text = row(9).ToString
MessageBox.Show("RECORD HAVE EDITED & UPDATED!")
Catch ex As Exception
MessageBox.Show("WRONG VALUE WAS ENTERED")
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
TextBox11.Text = ""
Finally
conn.Close()
End Try
End If
End Sub

Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
Dim par As String
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\LAND.mdb" & """"
conn.Open()
If TextBox10.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Or TextBox5.Text = "" Or TextBox6.Text = "" Or TextBox7.Text = "" Or TextBox8.Text = "" Or TextBox9.Text = "" Or TextBox10.Text = "" Or TextBox11.Text = "" Then
MessageBox.Show("Enter Plot No. and other details Before Edition!")
conn.Close()

ElseIf MessageBox.Show("ARE YOU SURE TO DELETE THIS RECORD", "DELETE RECORD!", MessageBoxButtons.YesNoCancel) = Windows.Forms.DialogResult.Yes Then
Try
par = "DELETE FROM LAND WHERE PLOT_NO=" & TextBox10.Text
Dim adp As New OleDb.OleDbDataAdapter(par, conn)
adp.Fill(dset, "LAND")
row = dset.Tables("LAND").Rows(dset.Tables("LAND").Rows.Count - 1)
TextBox2.Text = row(1).ToString
TextBox3.Text = row(5).ToString
TextBox4.Text = row(2).ToString
TextBox5.Text = row(6).ToString
TextBox6.Text = row(3).ToString
TextBox7.Text = row(7).ToString
TextBox8.Text = row(4).ToString
TextBox9.Text = row(8).ToString
TextBox10.Text = row(0).ToString
TextBox11.Text = row(9).ToString
MessageBox.Show("RECORD HAVE DELETED & UPDATED!")
Catch ex As Exception
MessageBox.Show("WRONG VALUE WAS ENTERED")
Finally
conn.Close()
End Try
Else
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
TextBox11.Text = ""
conn.Close()
End If
End Sub

Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click

Try
row = dset.Tables("LAND").Rows(0)
Text1.Text = row(1).ToString
Text2.Text = row(5).ToString
Text3.Text = row(2).ToString
Text4.Text = row(6).ToString
Text5.Text = row(3).ToString
Text6.Text = row(7).ToString
Text7.Text = row(4).ToString
Text8.Text = row(8).ToString
Text9.Text = row(0).ToString
Text10.Text = row(9).ToString
i = 0
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try

End Sub

Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
If i = 0 Then
MessageBox.Show("Beginning Point of Record")
Else
i -= 1
Try
row = dset.Tables("LAND").Rows(i)
Text1.Text = row(1).ToString
Text2.Text = row(5).ToString
Text3.Text = row(2).ToString
Text4.Text = row(6).ToString
Text5.Text = row(3).ToString
Text6.Text = row(7).ToString
Text7.Text = row(4).ToString
Text8.Text = row(8).ToString
Text9.Text = row(0).ToString
Text10.Text = row(9).ToString
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End If
End Sub

Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click
If i = dset.Tables("LAND").Rows.Count Then
MessageBox.Show("End Point of Record")
Else
i += 1
Try
row = dset.Tables("LAND").Rows(i - 1)
Text1.Text = row(1).ToString
Text2.Text = row(5).ToString
Text3.Text = row(2).ToString
Text4.Text = row(6).ToString
Text5.Text = row(3).ToString
Text6.Text = row(7).ToString
Text7.Text = row(4).ToString
Text8.Text = row(8).ToString
Text9.Text = row(0).ToString
Text10.Text = row(9).ToString
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End If

End Sub

Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button19.Click
Try
row = dset.Tables("LAND").Rows(dset.Tables("LAND").Rows.Count - 1)
Text1.Text = row(1).ToString
Text2.Text = row(5).ToString
Text3.Text = row(2).ToString
Text4.Text = row(6).ToString
Text5.Text = row(3).ToString
Text6.Text = row(7).ToString
Text7.Text = row(4).ToString
Text8.Text = row(8).ToString
Text9.Text = row(0).ToString
Text10.Text = row(9).ToString
i = dset.Tables("LAND").Rows.Count - 1
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try

End Sub

Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
Dim par As String
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "" Or Text8.Text = "" Or Text9.Text = "" Or Text10.Text = "" Then
MessageBox.Show(" PLEASE ENTER DATA BEFORE ADD")
conn.Close()
Exit Sub
End If

par = "INSERT INTO LAND VALUES(" & Text9.Text & ",'" & Text1.Text & "','" & Text3.Text & "','" & Text5.Text & "','" & Text7.Text & "'," & Text2.Text & ",'" & Text4.Text & "','" & Text6.Text & "','" & Text8.Text & "','" & Text10.Text & "')"
Dim cmd As New OleDb.OleDbCommand(par, conn)
Try
cmd.CommandType = CommandType.Text
adp.SelectCommand = cmd
adp.Fill(dset, "LAND")
conn.Close()
Catch ex As Exception
MessageBox.Show("Either Duplicate ID or Bad Data have entered, cann't added")
conn.Close()
End Try
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\LAND.mdb" & """"
Try
conn.Open()
par = "SELECT * FROM LAND"
cmd.CommandText = par
adp.SelectCommand = cmd
adp.Fill(dset, "LAND")
row = dset.Tables("LAND").Rows(dset.Tables("LAND").Rows.Count - 1)
Text1.Text = row(1).ToString
Text2.Text = row(5).ToString
Text3.Text = row(2).ToString
Text4.Text = row(6).ToString
Text5.Text = row(3).ToString
Text6.Text = row(7).ToString
Text7.Text = row(4).ToString
Text8.Text = row(8).ToString
Text9.Text = row(0).ToString
Text10.Text = row(9).ToString
Catch ex As Exception
MessageBox.Show("Failed to connect to data source: " + ex.ToString)
Finally
conn.Close()
End Try

End Sub

Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
Dim par As String
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\LAND.mdb" & """"
conn.Open()
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "" Or Text8.Text = "" Or Text9.Text = "" Or Text10.Text = "" Then
MessageBox.Show(" PLEASE ENTER DATA BEFORE EDIT/UPDATE")
conn.Close()
Exit Sub
Else
par = "UPDATE LAND SET DEPARTMENT ='" & Text1.Text & "', BLOCK ='" & Text3.Text & "', LOCATION ='" & Text5.Text & "', RVENUE_CIRCLE ='" & Text7.Text & "', AREA =" & Text2.Text & ", STATUS ='" & Text4.Text & "', DEMARCATED_FENCED ='" & Text6.Text & "', STRUCTURE ='" & Text8.Text & "', REMARKS ='" & Text10.Text & "'" & " WHERE PLOT_NO =" & Text9.Text
Dim adp As New OleDb.OleDbDataAdapter(par, conn)
Try
adp.Fill(dset, "LAND")
row = dset.Tables("LAND").Rows(dset.Tables("LAND").Rows.Count - 1)
Text1.Text = row(1).ToString
Text2.Text = row(5).ToString
Text3.Text = row(2).ToString
Text4.Text = row(6).ToString
Text5.Text = row(3).ToString
Text6.Text = row(7).ToString
Text7.Text = row(4).ToString
Text8.Text = row(8).ToString
Text9.Text = row(0).ToString
Text10.Text = row(9).ToString
MessageBox.Show("RECORD HAVE EDITED & UPDATED!")
Catch ex As Exception
MessageBox.Show("WRONG VALUE WAS ENTERED")
Finally
conn.Close()
End Try
End If

End Sub

Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button20.Click
Dim par As String
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\LAND.mdb" & """"
conn.Open()
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "" Or Text8.Text = "" Or Text9.Text = "" Or Text10.Text = "" Then
MessageBox.Show("BLANK RECORD ARE HERE FOR DELETION")
conn.Close()
Exit Sub

ElseIf MessageBox.Show("ARE YOU SURE TO DELETE THIS RECORD", "DELETE RECORD!", MessageBoxButtons.YesNoCancel) = Windows.Forms.DialogResult.Yes Then
Try
par = "DELETE FROM LAND WHERE PLOT_NO=" & Text9.Text
Dim adp As New OleDb.OleDbDataAdapter(par, conn)
adp.Fill(dset, "LAND")
row = dset.Tables("LAND").Rows(dset.Tables("LAND").Rows.Count - 1)
Text1.Text = row(1).ToString
Text2.Text = row(5).ToString
Text3.Text = row(2).ToString
Text4.Text = row(6).ToString
Text5.Text = row(3).ToString
Text6.Text = row(7).ToString
Text7.Text = row(4).ToString
Text8.Text = row(8).ToString
Text9.Text = row(0).ToString
Text10.Text = row(9).ToString
MessageBox.Show("RECORD HAVE DELETED & UPDATED!")
Catch ex As Exception
MessageBox.Show("WRONG VALUE WAS ENTERED")
Finally
conn.Close()
End Try
Else
conn.Close()
End If
End Sub

Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button21.Click
Dim par As String
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Documents and Settings\admin\My Documents\LAND.mdb" & """"
Try
conn.Open()
par = "SELECT PLOT_NO FROM LAND"
Dim adp As New OleDb.OleDbDataAdapter(par, conn)
Catch ex As Exception
MessageBox.Show("Failed to connect to data source: " + ex.ToString)
Finally
conn.Close()
End Try
dset.Clear()
adp.Fill(dset, "LAND")
DataGridView1.DataSource = dset
DataGridView1.DataMember = "LAND"
DataGridView1.Refresh()
End Sub

Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
DataGridView1.DataSource = Nothing
DataGridView1.DataMember = Nothing
DataGridView1.Refresh()
conn.Close()
End Sub

Private Sub Button22_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button22.Click
Try
row = dset.Tables("LAND").Rows(0)
TextBox2.Text = row(1).ToString
TextBox3.Text = row(5).ToString
TextBox4.Text = row(2).ToString
TextBox5.Text = row(6).ToString
TextBox6.Text = row(3).ToString
TextBox7.Text = row(7).ToString
TextBox8.Text = row(4).ToString
TextBox9.Text = row(8).ToString
TextBox10.Text = row(0).ToString
TextBox11.Text = row(9).ToString
c = 0
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub

Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button23.Click
If c = 0 Then
MessageBox.Show("Beginning Point of Record")
Else
c -= 1
Try
row = dset.Tables("LAND").Rows(c)
TextBox2.Text = row(1).ToString
TextBox3.Text = row(5).ToString
TextBox4.Text = row(2).ToString
TextBox5.Text = row(6).ToString
TextBox6.Text = row(3).ToString
TextBox7.Text = row(7).ToString
TextBox8.Text = row(4).ToString
TextBox9.Text = row(8).ToString
TextBox10.Text = row(0).ToString
TextBox11.Text = row(9).ToString
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End If
End Sub

Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button24.Click
If c = TextBox14.Text Then
MessageBox.Show("End Point of Record")
Else
c += 1
Try
row = dset.Tables("LAND").Rows(c - 1)
TextBox2.Text = row(1).ToString
TextBox3.Text = row(5).ToString
TextBox4.Text = row(2).ToString
TextBox5.Text = row(6).ToString
TextBox6.Text = row(3).ToString
TextBox7.Text = row(7).ToString
TextBox8.Text = row(4).ToString
TextBox9.Text = row(8).ToString
TextBox10.Text = row(0).ToString
TextBox11.Text = row(9).ToString
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End If
End Sub

Private Sub Button25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button25.Click
Try
row = dset.Tables("LAND").Rows(dset.Tables("LAND").Rows.Count - 1)
TextBox2.Text = row(1).ToString
TextBox3.Text = row(5).ToString
TextBox4.Text = row(2).ToString
TextBox5.Text = row(6).ToString
TextBox6.Text = row(3).ToString
TextBox7.Text = row(7).ToString
TextBox8.Text = row(4).ToString
TextBox9.Text = row(8).ToString
TextBox10.Text = row(0).ToString
TextBox11.Text = row(9).ToString
i = dset.Tables("LAND").Rows.Count - 1
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
End Class [ 21 NOV 2009 1:32 PM ]

No comments:

Post a Comment