Monday, May 10, 2010

Core Differences Between IIS and the ASP.NET Development Server

When testing an ASP.NET application locally, chances are you are using the ASP.NET Development Web Server. However, the production website is most likely powered IIS. There are some differences between how these web servers handle requests, and these differences can have important consequences. This tutorial explores some of the more germane differences.


The good news is that most web host providers have some sort of permissions tool that allows you to specify file system permissions in your website. Grant the anonymous ASP.NET account write access to the root directory and then revisit the book review page. (If needed, contact your web host provider for assistance on how to grant write permissions to the default ASP.NET account.) This time the page should load without error and the LastTYASP35Access.txt file should be created successfully.

The take away here is that because the ASP.NET Development Server operates under a different security context than IIS, it is possible that your ASP.NET pages that read or write to the file system, read from or write to the Windows Event Log, or read or write to the Windows registry will work as expected on development but generate exceptions when on production. When building a web application that will be deployed to a shared web hosting environment, do not read or write to the Event Log or the Windows registry. Also take note of any ASP.NET pages that read from or write to the file system as you may need to grant read and write privileges on the appropriate folders in the production environment.

Differences On Serving Static Content
Another core difference between IIS and the ASP.NET Development Server is how they handle requests for static content. Every request that comes into the ASP.NET Development Server, whether for an ASP.NET page, an image, or a JavaScript file, is processed by the ASP.NET runtime. By default, IIS only invokes the ASP.NET runtime when a request comes in for an ASP.NET resource, such as an ASP.NET web page, a Web Service, and so forth. Requests for static content - images, CSS files, JavaScript files, PDF files, ZIP files, and the like - are retrieved by IIS without the involvement of the ASP.NET runtime. (It is possible to instruct IIS to work with the ASP.NET runtime when serving static content; consult the "Performing Forms-Based Authentication and URL Authentication on Static Files with IIS 7" section in this tutorial for more information.)

The ASP.NET runtime performs a number of steps to generate the requested content, including authentication (identifying the requestor) and authorization (determining if the requestor has permission to view the requested content). A popular form of authentication is forms-based authentication, in which a user is identified by entering their credentials - usually a username and password - into textboxes on a web page. Upon validating their credentials, the website stores an authentication ticket cookie on the user's browser, which is sent with every subsequent request to the website and is what is used to authenticate the user. Moreover, it is possible to specify URL authorization rules that dictate what users can or cannot access a particular folder. Many ASP.NET websites use forms-based authentication and URL authorization to support user accounts and to define portions of the site that are only accessible to authenticated users or users that belong to a certain role.

Note: For a thorough examination of ASP.NET's forms-based authentication, URL authorization, and other user account-related features, be sure to check out my Website Security Tutorials.

Consider a website that supports user accounts using forms-based authorization and has a folder that, using URL authorization, is configured to only allow authenticated users. Imagine that this folder contains ASP.NET pages and PDF files and that the intent is that only authenticated users can view these PDF files.

What happens if a visitor attempts to view one of these PDF files by entering the URL directly in his browser's Address bar? To find out, let's create a new folder in the Book Reviews site, add some PDF files, and configure the site to use URL authorization to prohibit anonymous users from visiting this folder. If you download the demo application you'll see that I created a folder called PrivateDocs and added a PDF from my Website Security Tutorials (how fitting!). The PrivateDocs folder also contains a Web.config file that specifies the URL authorization rules to deny anonymous users:










Finally, I configured the web application to use forms-based authentication by updating the Web.config file in the root directory, replacing:

With:


Whenever a user visits an ASP.NET application his browser sends a request to the website. That request is picked up by the web server software, which coordinates with the ASP.NET runtime to generate and return the content for the requested resource. The Internet Information Services (IIS) are a suite of services that provide common Internet-based functionality for Windows servers. IIS is the most commonly used web server for ASP.NET applications in production environments; it's most likely the web server software being used by your web host provider to serve your ASP.NET application. IIS can also be used as the web server software in the development environment, although this entails installing IIS and properly configuring it.

The ASP.NET Development Server is an alternative web server option for the development environment; it ships with and is integrated into Visual Studio. Unless the web application has been configured to use IIS, the ASP.NET Development Server is automatically started and used as the web server the first time you visit a web page from within Visual Studio. The demo web applications we created back in the Determining What Files Need to Be Deployed tutorial were both file system-based web applications that were not configured to use IIS. Therefore, when visiting either of these websites from within Visual Studio the ASP.NET Development Server is used.

In a perfect world the development and production environments would be identical. However, as we discussed in the preceding tutorial it is not uncommon for the environments to have differing configuration settings. Using different web server software in the environments adds another variable that must be taken into consideration when deploying an application. This tutorial covers the key differences between IIS and the ASP.NET Development Server. Because of these differences there are scenarios where code that runs flawlessly in the development environment throws an exception or behaves differently when executed in production.

Security Context Differences
Whenever the web server software handles an incoming request it associates that request with a particular security context. This security context information is used by the operating system to determine what actions are permissible by the request. For example, an ASP.NET page might include code that logs some message to a file on disk. In order for this ASP.NET page to execute without error, the security context must have the appropriate file system-level permissions, namely write permissions on that file.

Using the ASP.NET Development Server, visit the site and enter the direct URL to one of the PDF files in your browser's Address bar. If you downloaded the website associated with this tutorial the URL should look something like: http://localhost:portNumber/PrivateDocs/aspnet_tutorial01_Basics_vb.pdf

Entering this URL into the Address bar causes the browser to send a request to the ASP.NET Development Server for the file. The ASP.NET Development Server hands off the request to the ASP.NET runtime for processing. Because we have not yet logged in, and because the Web.config in the PrivateDocs folder is configured to deny anonymous access, the ASP.NET runtime automatically redirects us to the login page, Login.aspx (see Figure 3). When redirecting the user to the log in page, ASP.NET includes a ReturnUrl querystring parameter that indicates the page the user was attempting to view. After successfully logging in the user can be returned to this page.



The ASP.NET Development Server associates incoming requests with the security context of the currently logged on user. If you are logged on to your desktop as an administrator, then the ASP.NET pages served by the ASP.NET Development Server will have the same access rights as an administrator. However, ASP.NET requests handled by IIS are associated with a specific machine account. By default, the Network Service machine account is used by IIS versions 6 and 7, although your web host provider may have configured a unique account for each customer. What's more, your web host provider has likely given limited permissions to this machine account. The net result is that you may have web pages that execute without error in the development environment, but generate authorization-related exceptions when hosted in the production environment.

To show this type of error in action I've created a page in the Book Reviews website that creates a file on disk that stores the most recent date and time someone viewed the Teach Yourself ASP.NET 3.5 in 24 Hours review. To follow along, open the ~/Tech/TYASP35.aspx page and add the following code to the Page_Load event handler:

protected void Page_Load(object sender, EventArgs e)
{
string filePath = Server.MapPath("~/LastTYASP35Access.txt");
string contents = string.Format("Last accessed on {0} by {1}",
DateTime.Now.ToString(), Request.UserHostAddress);

System.IO.File.WriteAllText(filePath, contents);
}

Note: The File.WriteAllText method creates a new file if it does not exist and then writes the specified contents to it. If the file already exists, it's existing content is overwritten.

Monday, April 26, 2010

SSL Clone




SSThe compressor is cloned from our good old SSL4044E desk, dating back from '85. The SSL mixbus compressor is an integral part of the mixer's main quad fader and autofade system - cards 82E26 and 82E27, and as you can see if you compare these to my schematic, a series of changes have been made for rehousing the circuit. The main changes concerns the electronically balanced input and output and the removal of unneded components regarding the autofade and main fader circuits. Another change is that the sidechain is common to both VCA's, making better tracking abilities - your mix wont' "tilt" so easy when you're compressing heavily. We did things like that to the SSL in the old days. This might seem like a big change, but actually the sonics are preserved very close to the original, and tracking errors are cancelled.
This is a design I did way back in my early years, so you'll have to bear with the ugly pcb layouts. And sorry, this design is absolutely free from tubes and transformers. But it has a nice moving coil meter at least.

My reason for doing this clone is that the SSL is one of the worlds widely recognized stereo mix compressors - it has a well known sound, and is lusted after by many recording engenieers. But the SSL4000 desk is prized as to be out of reach for most small studio owners. This design is - as you'll see - quite simple, easy and economically reachable, so I thought it would make a fine DIY-project for people that know their soldering iron and wants to start building pro quality DIY audio equipment. The beauty of this design is that - contrary to a lot of other esoteric projects - the components are (relatively) easy available anywhere, and no special knowledge, tools or adjustments are needed.

THE COMPONENTS:

The DBX 202XT VCA can be very hard to get these days, so I designed a substitution circuit based on the THAT2180/2181 type VCA - a recent version of the DBX2150 that SSL also uses for their channel compressors. This substitute circuit is based on reverse-engeineering a 202XT VCA - it turned out to consist of ten paralleled 2150's with a common low-impedance buffer for the control inputs. So this is the substitute, but done with only one THAT2180 (or 2181).

I've built the compressor with both the 202, 2150 and 2181, and the "sound" dosent seem to be that different, only the 202 may tend to be a little more transparant than the 2150 - but that's not always a good thing in compressors. Btw, DBX chip production is long gone now, but "Thats" are more than decent substitutes. The "That 2180" is a pre-trimmed replacement for the 2150, the 2181 has external trim. If using the pre-trimmed THAT2180 VCA's, simply cut off (or bend to the side) pin4, which is the distortion trim connection. The THAT VCA's are available - not everywhere, but still - from several web-based sources nowadays - my favorite supplier is ProFusion in the UK - they will sell small amounts, and will ship to all over the world

As this compressor was originally designed for using the - now obsolete - DBX2150 VCA's, there is a change in one resistor that is necessary to obtain the correct ratios - look here to see the component in question - the 100K resistor marked has to be replaced by a 127K resistor to compensate for higher input current sensitivity on the new chips.
The anatomy of this compressor is surprisingly simple:

Input signals are de-balanced by a couple of NE5534's, who in turn are driving the VCA in current mode via 27K resistors - the THAT VCA's are current in - current out devices (note that on the old component overlay, these resistors are marked 15K look here). From the VCA's the signal is taken to a current-to-voltage converter combined with a simple, yet proven, balanced output drive stage, consisting of two NE5532's. This concludes the story of the audio path. Not much electronics to mess up your precious audio signal here.

The signals from the input opamps are also summed via 47k's and sent to the input of the sidechain VCA. The purpose of this VCA is to act like a tracking "dummy" VCA, paralleling the GR action of the main VCA's, and thereby making it possible (in the original design, the 4000E console) to use the single set of main VCA's for compression, fader, computer and autofader at the same time - without having to resort to less predictable feed-forward compression schemes. So this is a combination of a feed-forward and a feed-back arcitechture, acting mostly as a feed-back compressor

The sidechain signal that is obtained after the VCA is then full-wave rectified by two TL074-stages, and at this point an offset is added - and signal gain is controlled - by the ratio switch. The ratio switch actually changes the threshold a bit to compensate for level flukturations caused by different ratio settings. This is the only part of the design that in any way differs from a direct off-the-application-note design.

The rectified sidechain DC is now fed thru the bypass switch and one of the bank of resistors selected with the "attack time" switch, to charge a tantalum capacitor selected with the "release time" switch. These release tantalums are bypassed with different sized discharge resistors, each delivering the desired release time. The fifth step on the release is an "Auto" setting, combining two release time constants (91k+6u8 and 750k+u47). This will give short time constants for short programme peaks, but if compression is going on for a longer time, the slow time constant will set in. Right after the book.

This rectified - and now timed - DC sidechain signal is buffered, and sent to three different circuits:

First of all it's summed with a DC voltage coming from the "makeup gain" pot, and used to control the main VCA's. On the original SSL compressor the makeup gain pot is active all the time, so when bypassed there's excess gain. On the control PCB I've made an option for disconnecting the makeup gain when bypassed, leaving the makeup gain more useable for in/out comparison. This can be shorted if you prefer the original scheme - but I don't think you will.

The DC sidechain control signal is also summed with another DC voltage - coming from the "threshold" pot - and used to control the sidechain VCA. In this way the added gain in the sidechain VCA looks to the rectifier like there's more signal coming in, changing the threshold this way. The "real" threshold to be overcome before charging the attack/release caps, is the 0.6V AK voltage across the diode placed between the fullwave rectifier and the A/R timing. Note that, for use with modern-day levels, the threshold potentiometer can seem to be too sensitive; in this case, mount a 47K resistor between the control PCB and the +side of the threshold potentiometer - look here for details

The last use of the rectified, timed and and buffered signal is driving the 1mA GR-meter for monitoring of the ongoing compression. This is linear scale, at about 50uA/dB, making a 1mA meter showing 20dB full-scale. If you want to have a meter reading of 0-10dB full scale, replace the 2K resistor (on the main board, right next to the connector to the control board) with a 1K. You can use just about any linear-scale meter you like, just changing the 2K resistor in series with it. For a 100uA meter, the simplest way is to shunt a 330R resistor across the meter. Another option is to mount a trimmer potentiometer right at the meter, and adjust to taste

The power supply part should be pretty much self-explanatory, the only weird part being that it's both +-12V and +-15V. The 12V's are used in the board as subregulators for obtaining predictable gains in case the main (+-15V) supply fluctuates.

Thursday, November 12, 2009

PASSWORD SNIFFER

SmartSniff - Monitoring TCP/IP packets on your network adapter
Mail PassView - Recover POP3/IMAP/SMTP email passwords.
Dialupass - Recover VPN/RAS/Dialup passwords
___________________________________________________________________

SniffPass is small password monitoring software that listens to your network, capture the passwords that pass through your network adapter, and display them on the screen instantly. SniffPass can capture the passwords of the following Protocols: POP3, IMAP4, SMTP, FTP, and HTTP (basic authentication passwords).
You can use this utility to recover lost Web/FTP/Email passwords.
In order to start using SniffPass, follow the instructions below:
If you have Windows 9x, Windows NT, or Windows XP with SP1, you must download and install the WinPcap capture driver in order to use SniffPass.
In all other versions of Windows (including Windows XP with SP2), installing this capture driver is optional. If you don't install this driver, you can still use the raw sockets method for capturing the passwords.
Run the executable file of SniffPass (SniffPass.exe).
From the File menu, select "Start Capture", or simply click the green play button in the toolbar. If it's the first time that you use SniffPass, you'll be asked to select the capture method and the network adapter that you want to use.
After you select the desired capture options, SniffPass listen to your network adapter, and display instantly any password that it find.

Command-Line Options
Command Description
/NoCapDriver Starts SniffPass without loading the WinPcap Capture Driver.
/NoReg Starts SniffPass without loading/saving your settings to the Registry.


Translating SniffPass to other languages
SniffPass allows you to easily translate all menus, dialog-boxes, and other strings to other languages.
In order to do that, follow the instructions below:
Run SniffPass with /savelangfile parameter:
SniffPass.exe /savelangfile
A file named SniffPass_lng.ini will be created in the folder of SniffPass utility.
Open the created language file in Notepad or in any other text editor.
Translate all menus, dialog-boxes, and string entries to the desired language. Optionally, you can also add your name and/or a link to your Web site. (TranslatorName and TranslatorURL values) If you add this information, it'll be used in the 'About' window.
After you finish the translation, Run SniffPass, and all translated strings will be loaded from the language file.
If you want to run SniffPass without the translation, simply rename the language file, or move it to another folder.

SocketSniff allows you to watch the Windows Sockets (WinSock) activity of the selected process.
For each created socket, the following information is displayed: socket handle, socket type, local and remote addresses, local and remote ports, total number of send/receive bytes, and more. You can also watch the content of each send or receive call, in Ascii mode or as Hex Dump
SocketSniff doesn't require any installation process or additional dll files. In order to start using it, simply run the executable file - SocketSniff.exe
After running it, select the process that you want to inspect, and click Ok. You must select a process that already loaded the winsock library, otherwise, the action will fail. After clicking Ok, SocketSniff will start showing the activity of Windows socket for the selected process.
The upper pane displays the list of all created sockets. When selecting a socket in the upper pane, the lower pane displays the receive and send calls of the selected socket.

Using SocketSniff In Windows Vista
SocketSniff can work in Vista even when UAC (User Account Control) is turned on, as long as the process that you wish to inspect run in the same account and security context of SocketSniff. However, if you want to inspect a process that runs under administrator account, you must also run SocketSniff as administrator. (right-click on SocketSniff.exe and choose 'Run As Administrator')

Translating SocketSniff to other languages
In order to translate SocketSniff to other language, follow the instructions below:
Run SocketSniff with /savelangfile parameter:
SocketSniff.exe /savelangfile
A file named SocketSniff_lng.ini will be created in the folder of SocketSniff utility.
Open the created language file in Notepad or in any other text editor.
Translate all string entries to the desired language. Optionally, you can also add your name and/or a link to your Web site. (TranslatorName and TranslatorURL values) If you add this information, it'll be used in the 'About' window.
After you finish the translation, Run SocketSniff, and all translated strings will be loaded from the language file.
If you want to run SocketSniff without the translation, simply rename the language file, or move it to another folder.
____________________________________________________________________
Network Tools - Other network monitoring tools of NirSoft.
NetResView - View all computers/shares on your network.
SmartSniff - Capture TCP/IP packets on your network adapter
DownTester - Test the download speed of your Internet connection.
SocketSniff - Windows Sockets (WinSock) Sniffer
SniffPass - Capture POP3/IMAP/SMTP/FTP/HTTP passwords on your network adapter.
AdapterWatch - Monitor your network adapters
IPNetInfo - Retrieve IP Address Information from WHOIS servers
_______________________________________________________________

CurrPorts is network monitoring software that displays the list of all currently opened TCP/IP and UDP ports on your local computer. For each port in the list, information about the process that opened the port is also displayed, including the process name, full path of the process, version information of the process (product name, file description, and so on), the time that the process was created, and the user that created it.
In addition, CurrPorts allows you to close unwanted TCP connections, kill the process that opened the ports, and save the TCP/UDP ports information to HTML file , XML file, or to tab-delimited text file.
CurrPorts also automatically mark with pink color suspicious TCP/UDP ports owned by unidentified applications (Applications without version information and icons)
CurrPorts utility is a standalone executable, and it doesn't require any installation process or additional DLLs. In order to start using it, just copy the executable file (cports.exe) to any folder you like, and run it.
The main window of CurrPorts displays the list of all currently opened TCP and UDP ports. You can select one or more items, and then close the selected connections, copy the ports information to the clipboard, or save it to HTML/XML/Text file. If you don't want to view all available columns, or you want to change the order of the columns on the screen and in the files you save, select 'Choose Column' from the View menu, and select the desired columns and their order. In order to sort the list by specific column, click on the header of the desired column.

Command-Line Options
/stext Save the list of all opened TCP/UDP ports into a regular text file.
/stab Save the list of all opened TCP/UDP ports into a tab-delimited text file.
/scomma Save the list of all opened TCP/UDP ports into a comma-delimited text file.
/stabular Save the list of all opened TCP/UDP ports into a tabular text file.
/shtml Save the list of all opened TCP/UDP ports into HTML file (Horizontal).
/sverhtml Save the list of all opened TCP/UDP ports into HTML file (Vertical).
/sxml Save the list of all opened TCP/UDP ports to XML file.
/sort This command-line option can be used with other save options for sorting by the desired column. If you don't specify this option, the list is sorted according to the last sort that you made from the user interface. The parameter can specify the column index (0 for the first column, 1 for the second column, and so on) or the name of the column, like "Remote Port" and "Remote Address". You can specify the '~' prefix character (e.g: "~Remote Address") if you want to sort in descending order. You can put multiple /sort in the command-line if you want to sort by multiple columns.
Examples:
cports.exe /shtml "f:\temp\1.html" /sort 2 /sort ~1
cports.exe /shtml "f:\temp\1.html" /sort "Protocol" /sort "~Remote Address"

/nosort When you specify this command-line option, the list will be saved without any sorting.
/filter Start CurrPorts with the specified filters. If you want to specify more than one filter, use the ';' character as a delimiter.
/cfg Start CurrPorts with the specified config file.

Here's some examples:

Save all opened TCP/IP ports created by Internet Explorer browser to HTML file:
cports.exe /filter "include:process:iexplore" /shtml "c:\temp\ports.html"
Add all opened ports information to ports.txt (as tab-delimited text file). This example only works when running it from a command-prompt window.
cports.exe /stab "" >> c:\temp\cports1.txt
Start CurrPorts with filter that will only display the opened ports of Internet Explorer and FireFox:
cports.exe /filter "include:process:firefox;include:process:iexplore"

Closing a Connection From Command-Line
Starting from version 1.09, you can close one or more connections from command-line, by using /close parameter.
The syntax of /close command:
/close
For each parameter, you can specify "*" in order to include all ports or addresses.
Examples:

Close all connections with remote port 80 and remote address 192.168.1.10:
/close * * 192.168.1.10 80
Close all connections with remote port 80 (for all remote addresses):
/close * * * 80
Close all connections to remote address 192.168.20.30:
/close * * 192.168.20.30 *
Close all connections with local port 80:
/close * 80 * *

Translating CurrPorts To Another Language
CurrPorts allows you to easily translate all menus, dialog-boxes, and other strings to other languages.
In order to do that, follow the instructions below:
Run CurrPorts with /savelangfile parameter:
cports.exe /savelangfile
A file named cports_lng.ini will be created in the folder of CurrPorts utility.
Open the created language file in Notepad or in any other text editor.
Translate all menus, dialog-boxes, and string entries to the desired language.
After you finish the translation, Run CurrPorts, and all translated strings will be loaded from the language file.
If you want to run CurrPorts without the translation, simply rename the language file, or move it to another folder.
_______________________________________
Disk Doctors Outlook Mail Recovery - Repairs corrupt and damaged .pst files.
MessenPass - Recover the passwords of 'Instant Messenger' applications.
IE PassView - Recover the passwords of Internet Explorer.
Dialupass - Recover VPN/RAS/Dialup passwords
Asterisk Logger - Recover passwords stored behind asterisk (**) characters.
Network Password Recovery - Recover Windows XP/Vista network passwords (Credentials file)
____________________________________________

Mail PassView is a small password-recovery tool that reveals the passwords and other account details for the following email clients:

Outlook Express
Microsoft Outlook 2000 (POP3 and SMTP Accounts only)
Microsoft Outlook 2002/2003/2007 (POP3, IMAP, HTTP and SMTP Accounts)
Windows Mail
Windows Live Mail
IncrediMail
Eudora
Netscape 6.x/7.x (If the password is not encrypted with master password)
Mozilla Thunderbird (If the password is not encrypted with master password)
Group Mail Free
Yahoo! Mail - If the password is saved in Yahoo! Messenger application.
Hotmail/MSN mail - If the password is saved in MSN/Windows/Live Messenger application.
Gmail - If the password is saved by Gmail Notifier application, Google Desktop, or by Google Talk.
For each email account, the following fields are displayed: Account Name, Application, Email, Server, Server Type (POP3/IMAP/SMTP), User Name, and the Password.

If your email program is not supported by Mail PassView, you can still recover your password by using this Password Sniffer
Translating Mail PassView to other languages
Mail PassView allows you to easily translate all dialog-boxes, menus, and strings to other language.
In order to do that, follow the instructions below:
Run Mail PassView with /savelangfile parameter:
mailpv.exe /savelangfile
A file named mailpv_lng.ini will be created in the folder of Mail PassView utility.
Open the created language file in Notepad or in any other text editor.
Translate all menus, dialog-boxes, and string entries to the desired language.
After you finish the translation, Run Mail PassView, and all translated strings will be loaded from the language file.
If you want to run Mail PassView without the translation, simply rename the language file, or move it to another folder.
_____________________

When you use the "Dial-Up Networking" module for connecting to the internet or to other networks, the operating system give you the option to store the password and use it when it needed. Although the password is constantly stored in your computer, the operating system doesn't allow you to watch it. if you forget your password and you want to extract it from your computer, you can use the Dialupass utility for viewing the password.
This utility enumerates all Dial-Up entries on your computer and reveals their logon details: User Name, Password and Domain.
it works perfectly in the following operating systems: Windows 95, Windows 98, Windows ME, Windows NT, Windows 2000, and Windows XP. In Windows 2000 and Windows XP, the Dialupass utility can reveal the Dial-Up passwords only if you are logged on with administrator privileges. Using Dialupass
The Dialupass utility is a standalone application, and it doesn't require any installation process or additional DLLs. Just copy the dialupass.exe to any folder you want and run it. After you run it, it'll instantly show all your Dial-Up accounts and their user/password details.
You can also select one or more Dial-Up items (by using Ctrl and Shift keys), and then save them into a readable or tab-limited text file , or copy them into the clipboard (Ctrl+C).

the Dialupass utility also allows you to easily edit the logon details: user name, password and domain. You can get the editing dialog-box by double-clicking the item you want to edit.


Viewing the logon details of other users
Under Windows 2000/XP, you can view the logon details of other users in the same computer. Simply press Ctrl+U, and select the desired user, or select to view the passwords of all user profiles in your system. In order to view the logon details of other users under Windows NT, you should run Dialupass in advanced mode, by using the /adv option: dialupass.exe /adv

Command-Line Options
Option Description
/stext Save the list of all dial-up items into a regular text file.
/stab Save the list of all dial-up items into a tab-delimited text file.
/stabular Save the list of all dial-up items into a tabular text file.
/shtml Save the list of all dial-up items into horizontal HTML file.
/sverhtml Save the list of all dial-up items into vertical HTML file.

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 ]