Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
Asp.net Mvc 5 y Azure
Asp.net Mvc 5 y Azure
Loading in …3
×
1 of 252

Learn ASP

12

Share

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Learn ASP

  1. 1. ASP ACTIVE SERVER PAGE
  2. 2. ASP developed in November 1996 by Microsoft. An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are executed on the server.
  3. 3. 1. ASP stands for Active Server Pages 2. ASP is a program that runs inside IIS 3. IIS stands for Internet Information Services 4. IIS comes as a free component with Windows 2000 5. IIS is also a part of the Windows NT 4.0 Option Pack 6. The Option Pack can be downloaded from Microsoft 7. PWS is a smaller - but fully functional - version of IIS 8. PWS can be found on your Windows 95/98 CD
  4. 4. • Dynamically edit, change or add any content of a Web page • Respond to user queries or data submitted from HTML forms • Access any data or databases and return the results to a browser
  5. 5. • Customize a Web page to make it more useful for individual users • The advantages of using ASP instead of CGI and Perl, are those of simplicity and speed • Provide security since your ASP code can not be viewed from the browser • Clever ASP programming can minimize the network traffic
  6. 6. ASP is a mixture of HTML and scripting that enables you to build dynamic and database- driven web sites. ASP is a server - side scripting environment that we can use to create and run dynamic, interactive, high - performance Web server applications."
  7. 7. A server is a computer (Usually high-end, "Faster, Bigger") that allows computers in a network to have a shared resource. Most servers in the area are used to share files to run programs or to share Printers The different rolls that servers play in the area are:
  8. 8. PDC (Primary Domain Controller) These servers are the bosses of 1 or more servers. All usernames and passwords are kept on the PDC. BDC (Backup Domain Controller) These servers are the backups which take over if the PDC fails. They keep a copy of the Usernames and Passwords to validate logons incase the PDC is busy. Server These servers are just ordinary servers that can join a domain but can not replace a PDC like a BDC. These servers usually are setup to just share files or printers.
  9. 9. Print Server These servers are usually assigned network printers to share and maintain. File Servers These servers have folders/directories shared for access by network users. Application Servers These servers have programs that are shared across the network to multiple computers. A server can only be one of these but can be any combination of file, print, and application server
  10. 10. A protocol is a set of rules that governs the communications between computers on a network. These rules include guidelines that regulate the following characteristics of a network access method, allowed physical space, types of cabling, and speed of data transfer. The most common protocols are: Ethernet Local Talk Token Ring FDDI ATM
  11. 11. HTTP (Hypertext Transfer Protocol) is the set of rules for transferring files (text, graphic images, sound, video, and other multimedia files) on the World Wide Web. As soon as a Web user opens their Web browser, the user is indirectly making use of HTTP.
  12. 12. PWS is for older Windows system like Windows 95, 98, and NT. PWS is easy to install and can be used for developing and testing web applications including ASP.
  13. 13. Open the Add-ons folder on your Windows98 CD, find the PWS folder and run the setup.exe file. An Inetpub folder will be created on your hard drive. Open it and find the wwwroot folder. Create a new folder, like "MyWeb", under wwwroot. Use a text editor to write some ASP code, save the file as "test1.asp" in the "MyWeb" folder. Make sure your Web server is running – The installation program has added a new icon on your task bar this is the PWS symbol). Click on the icon and press the Start button in the window that appears. Open your browser and type in http://localhost/MyWeb/test1.asp", to view your first ASP page.
  14. 14. Note: You cannot run ASP on Windows XP Home Edition. Insert the Windows XP Professional CD-Rom into your CD-Rom Drive From your Start Button, go to Settings, and Control Panel In the Control Panel window select Add/Remove Programs In the Add/Remove window select Add/Remove Windows Components In the Wizard window check Internet Information Services , click OK
  15. 15. An Inetpub folder will be created on your hard drive Open the Inetpub folder, and find a folder named wwwroot Create a new folder , like "MyWeb", under wwwroot. Use a text editor to write some ASP code, save the file as "test1.asp" in the "MyWeb" folder Make sure your Web server is running - its status can be checked by going into the Control Panel, then Administrative Tools , and double-click the "IIS Manager" icon Open your browser and type in "http://localhost/MyWeb/test1.asp", to view your first ASP page
  16. 16. Client/server model is a concept for describing communications between computing processes that are classified as service consumers (clients) and service providers (servers).
  17. 17. Client/server describes the relationship between two computer programs in which one program, the client, makes a service request from another program, the server, which fulfills the request
  18. 18. Request client server Response
  19. 19. A scripting language has a particular syntax used to execute commands on a computer. A program composed of commands from a particular scripting language is referred to as a script.
  20. 20. The client, processes client side script. It is the client’s responsibility to execute all Client-Side scripts. Client side scripting is programmatic code in an HTML file that runs on the browser. It is denoted by the <Script> tag. It is commonly written using JavaScript Programming language due to the fact that Netscape support JavaScript language for client-side scripting.
  21. 21. Server-side scripts are processed completely on the web server. The client does not receive any code from server-side scripts; rather, the client receives just the output of the server-side scripts. Client-side scripts and server side scripts cannot interact with one another because the client – side scripts are executed on the client, after the server-side scripts have finished processing completely. ASP script is a server side scripting.
  22. 22. In order to activate ASP components and to use its objects, a script is placed on the Web page along with the HTML codes specifying how the generated information is to be formatted for display in the browser. This script is written in the VBScript language and is contained inside the special symbols <% and %> to indicate its presence to the server:
  23. 23. <% This is a script %>
  24. 24. After you have installed IIS or PWS follow these steps: 1. Look for a new folder called Inetpub on your hard drive 2.Open the Inetpub folder, and find a folder named wwwroot
  25. 25. 3. Write some ASP code and save the file as “first.asp" in the new folder 4. Make sure your Web server is running
  26. 26. 6. Open your browser and type "http://localhost/first.asp", to view your first web page
  27. 27. Response.write command is just like the printf command in C. The response.write command is used to write output to a browser. The following example sends the text “My First ASP Program !" to the browser:
  28. 28. <html> <head> <title>First ASP Program</title> </head> <body> <% response.write(“My First ASP Program !") %> </body> </html>
  29. 29. <% response.write "Hello ASP World<br>" response.write "Today is " & Date response.write " and the time is " & Time %>
  30. 30. ASP uses VBScript as its default programming language. This means VBScript comments are ASP comments. That means there isn't any support for multiple line comments that you see in HTML and various other programming languages.
  31. 31.  To create comment in ASP you simply place an apostrophe ‘ in front of what you want to make a comment.  <%  ‘This is a comment  Response.write(“this is a comment”)  %>
  32. 32. When the server invokes the ASP scripting engine, it parse the file and inserts any include files. It then collects the script portion by finding all the script delimiter.The ASP treats all non-script contents as strings that it writes verbatim(Exactly) back to the client. Next the scripting engine creates variables and external components invoked by the script. Finally it begins the script executing each command and sending results to the client.
  33. 33. Request ASP.DLL ASP Scripting Engine Response HTML Coding Processing Client Server
  34. 34.  The process of ASP script is goes through these five stages 1. Request: The web browser contacts the server and tells it what page it wants to see 2. Pre-processing : The asp.dill file does some initial processing on the requested script. 3. Execution : The scripting engine executes the instructions in the script 4. Translate: ASP translate the result of the execution into HTML 5. Display: The HTML is sent back to the browser,which process the tags and display it.
  35. 35. •A variable is used to store information for later use. •ASP is not a language in itself. To program ASP you actually need to know the VBScript scripting language. This means that all VBScript variable rules can be applied to your ASP code. •In ASP you declare a variable with the use of the Dim keyword, which is short for Dimension. •(Dimension in English refers to the amount of space something takes up in the real world, but in computer terms it refers to space in computer memory.)
  36. 36.  The value of each variable is held in the server's memory, so the value of the variable can be manipulated or displayed as needed within a page.  In VBScript, there is only one data type, and that is variant.  A variant can hold either strings or numbers, and will behave as a number if its numeric, and as a string for string values.  In ASP, it is not necessary to declare your variables before using them.  If, however, you choose to do so, you use the DIM statement
  37. 37.  ASP Variable Naming Conventions  Once again, ASP uses VBScript by default and so it also uses VBScripts variable naming conventions. These rules are: 1. Variable name must start with an alphabetic character (A through Z or a through z) 2. Variables cannot contain a period 3. Variables cannot be longer than 255 characters (don't think that'll be a problem!) 4. Variables must be unique in the scope in which it is declared.
  38. 38. Assigning values in ASP is straightforward enough, just use the equals "=" operator. Ahead we have set a variable equal to a number and a separate variable equal to a string.
  39. 39. A variable declared outside a procedure can be accessed and changed by any script in the ASP file.  A variable declared inside a procedure is created and destroyed every time the procedure is executed. No scripts outside the procedure can access or change the variable.  To declare variables accessible to more than one ASP file, declare them as session variables or application variables.
  40. 40.  Session Variables  Sessionvariables are used to store information about ONE single user, and are available to all pages in one application. Typically information stored in session variables are name, id, and preferences.  Application Variables  Application variables are also available to all pages in one application. Application variables are used to store information about ALL users in one specific application.
  41. 41. <% ' Note that lines starting with a single quote are comments. ' Commented lines are not executed. ' First, declare variables using Dim. This is optional Dim a, b, c, d, e, f a=1 b=2 c= a + b d="The value of " e=" plus " f=" equals " response.write (d & a & e & b & f & c) %> The script output is: The value of 1 plus 2 equals 3
  42. 42. <html> <body> <% dim name name=" Mickey Mouse " response .write ("My name is: " & name) %> </body> </html>
  43. 43. Comparison operators are used when you want to compare two values to make a decision. Comparison operators are most commonly used in conjunction with "If...Then" and "While statements, otherwise known as conditional statements. The items that are most often compared are numbers. The result of a comparison operator is either TRUE or FALSE.
  44. 44. A logical operator is used for complex statements that must make decisions based on one or more of these truth values.
  45. 45. The only string operator is the string concatenation operator "&" that takes two strings and join them together to form a new string. An example would be string1 = "Tim" and string2 = " is a Hero". The following code would combine these two strings into one: string3 = string1 & string2
  46. 46. A control structure is a programming structure that allows your program to make decisions. Types of controls There are three major types of controls structures 1. Conditional logic 2. Looping logic 3. Branching logic
  47. 47. Conditional logic allows you to match condition if condition matches then result come if condition not matches result not come Example In job selection form if age is less then 27 then you can fill form or if age is more then 27 then you are not eligible for this job.
  48. 48. <% Dim Result Result = 70 if Result >= 57 then response.write("Pass") else response.write("Fail") end if %>
  49. 49. <% Dim Result Result = 70 if Result >= 75 then response.write("Passed: Grade A ") elseif Result >= 60 then response.write("Passed: Grade B ") elseif Result >= 45 then response.write("Passed: Grade C ") else response.write("Failed ") end if %>
  50. 50. <%@ language="vbscript“%> <% Dim Flower Flower = "rose" select case flower case "rose" response.write(flower & " costs 20rs") case "daisy" response.write(flower & " costs 15rs") case "orchild" response.write(flower & " costs 12rs") case else response.write("There is no such flower in our shop") end select %>
  51. 51. ASP performs several types of repetitive operations, called "looping". Loops are set of instructions used to repeat the same block of code till a specified condition returns false or true depending on how you need it. To control the loops you can use counter variable that increments or decrements with each repetition of the loop.
  52. 52. <%@ language="vbscript" %> <% For i = 0 to 10 response.write("The number is " & i & "<br>") Next %>
  53. 53. <%@ language="vbscript" %> <% response.write("<h1>Multiplication table</h1>") response.write("<table border=2 width=50>") Dim i For i=1 to 10 response.write("<tr>") response.write("<td>"& i &"</td>") Dim j For j=2 to 43 response.write("<td>"&i * j &"</td>") Next response.write("</tr>") Next response.write("</table>") %>
  54. 54. <% Dim i i=0 Do While i<=10 response. write( i & "<br>") i=i+1 Loop %>
  55. 55. <% a=1 Do while a < 11 response.write "This is loop " & a & "<br>" a=a+1 Loop %> <% a=1 Do until a = 11 response.write "This is loop " & a & "<br>" a=a+1 Loop %>
  56. 56. <% a=1 Do until a = 11 If a < 6 then response.write "This is loop " & a & "<br>" a=a+1 Else Exit Do End If Loop %>
  57. 57.  The branch logic control refers to the process of leaving the current flow of the program to a new set of instructions. There are two types of branching logic controls: subroutines (procedure) and functions. The subroutines perform actions and functions compute values. We first start with subroutines.
  58. 58. Subroutines are used to perform an action. An example of action might be to print a message to the screen. When calling a VBScript or a JavaScript procedure from an ASP file written in VBScript, you can use the "call" keyword followed by the procedure name.
  59. 59.  Functions are written to perform calculations. Like subroutines, functions can take one or more arguments. Functions can also return one value.  A function begins with the keyword function and ends with the keyword END FUNCTION.  FUNCTION AbValue (inNo) If inNo < 0 then inNo = - inNo  END IF AbValue = inNo  END FUNCTION  The value that is returned by a function can be printed or assigned to another variable for later use in the program.
  60. 60. Functions and sub procedures have many similarities: • They can be called or invoked from anywhere within your script. •A function or sub procedure can be reused as many times as required, thus saving you time writing out repetitive code Both are blocks of self contained code that can accept arguments. •Both will only run when called or invoked from code elsewhere and will not run automatically when the page is loaded. The difference between a function and a sub is that a sub will do some stuff (like printing something to the screen) and then quit, while a function runs some code and then returns the result back to the code that called it. •A Function could be used to do a calculation and then return a result.
  61. 61. Insert the <%@ language="language" %> line above the <html> tag to write the procedure/function in another scripting language: <%@ language="javascript" %> <%@ language=“vbscript" %>
  62. 62. <html> <head> <% sub name() response.write (“My name is Hunter") end sub %> </head><body> <% response.write(“Welcome today is Monday") response.write("<br>") call name response.write("<br>") response.write("thanks") %> </body></html>
  63. 63. <html><head> <% function sum (x,y) sum=x+y end function %> </head><body> <% dim x,y,z x=20 y=40 z=sum(x,y) response.write ("sum is " & z) %> </body></html>
  64. 64.  Vb Scri pt arra y is 0 base d, mea ning that the arra y elem ent inde
  65. 65. static array remains with fixed size throughout their life open. To use static array you need to know upfront the maximum number of the elements this array will contain. If you need more flexible vb script array with variable index size, then you can use dynamic array. Dynamic array index size can be increased/decreased during their life span.
  66. 66.  Create static array called “arrcar” that will hold the name of five cars.  <%  Dim arrcar  arrcar=Array("Audi","Honda city","Mercedes","Safari","Bentley")  For I=0 to 4  Response.write arrcar(i) & "<br>"  Next  %>
  67. 67.  Dynamic array comes in handy (Versatile) when you aren’t sure how many items your array will hold. To create a dynamic array you should use the dim statement along with the array’s name, within specifying upper bound. <% dim arrcar arrcar=array() %> In order to use this array you need to use the ReDim statement to define the array’s upper bound:
  68. 68.  Dim arrcar  arrcar=Array()  Redim arrcar(27)  If in future you need to resize this array, you should use the redim statement again. Be very careful with the redim statement. When you use the redim statement you lose all the element of the array. Using the keyword PRESERVE in conjunction with the redim statement will keep the array we already have and increase the size.
  69. 69.  <%  Dim arrcar  Arrcar=array()  Redim arrcar(27)  Redim PRESERVE arrcar(52)  %>
  70. 70.  <%  Dim arrcar  redim arrcar(3)  arrcar=Array("Audi","Honda city","Mercedes","Safari","Bentley","lemo","alto")  redim preserve arrcar(7)  For i=0 to 6  Response.write arrcar(i) & "<br>"  Next  %>
  71. 71.  Array don’t have to be a simple list of keys and values, each location in the array can hold another array. The reason you may use this type of array is when you have records of each item.  For example car,year,price,…… and you want to display one record at a time. The most commonly used are two- dimensional arrays.You can thin of two dimensional array as a matrix, or grid , with width and height of rows and columns. Here is
  72. 72.  how you could define two-dimensional array and display the array values on the web page.  <%  dim arrcar(2,4)  arrcar(0,0)="honda city"  arrcar(1,0)="2009"  arrcar(2,0)="859598"  arrcar(0,1)="audi"  arrcar(1,1)="2009"  arrcar(2,1)="450000"
  73. 73.  arrcar(0,2)="honda city"  arrcar(1,2)="2009"  arrcar(2,2)="700000"  arrcar(0,3)="safri"  arrcar(1,3)="2009"  arrcar(2,3)="6,00000"  arrcar(0,4)="lemo"  arrcar(1,4)="2009"  arrcar(2,4)="990000"
  74. 74.  response.write ("<table border=2>")  response.write ("<tr> <td>row</td><td>car</td> <td>year</td> <td>price</td> </tr>")  for i=0 to ubound (arrcar,2)  response.write ("<tr> <td>" & i & "</td>")  response.write("<td>" & arrcar (0,i) & "</td>")  response.write("<td>" & arrcar (1,i) & "</td>")  response.write("<td>" & arrcar (2,i) & "</td>")  next  response.write("</table>")  %>
  75. 75.  dim a(1,1)  a(0,0)="HTML"  a(0,1)="Hyper Text Markup Language“  a(1,0)="ASP"  a(1,1)="Active Server Page“  for i=0 to ubound(a,1)  response.write("<table width=60% ><tr><td>")  response.write(a(0,i)& "</td><td>")  response.write(a(1,i)&"</td></tr>")  next  response.write("</table>")
  76. 76. Vb script is client side script language and run on client side so we do not require server and asp. It is lighter because no load at server it completely run at client side because all codes written in html.
  77. 77. Conversion of one data type to another is called type casting Cint Cdate Asc
  78. 78.  ASC  <%  response.write("ANSI code of a string is: " & asc("a"))  %>  Cdate  converts the date expression to the variant of subtype date  <%  a="march 14,1985"  response.write ("<br>" & cdate(a))  %>
  79. 79.  Cint  Converts an expression to a variant of subtype Integer.  <%  Response.write(Cint(2314.166))  %>
  80. 80.  Date  <%  response.write("current date of the system:“ & date)  %>  Time  <%  response.write(“Current time of the system" & time)  %>  Day  <%  response.write(“day of the system: " &day(date))  %>
  81. 81.  WeekDayName  <%  response.write(“Name of the weekday :" & weekdayname(1))  %>  WeekDay  <%  response.write("week day : " & weekday(date))  %>  Month  <%  response.write("<br> month" &month(date))  %>
  82. 82.  MonthName  response.write(“Name of the month“ & monthname(3))  Year  <%  response.write("year:“ & year(date))  %>
  83. 83.  DateDiff  <%  response.write("day" & datediff("d",date,“01/01/2000"))  response.write("<br> Year" & datediff("yyyy",date," 01/01/2000"))  response.write("<br> month" & datediff("m",date," 01/01/2000"))  response.write("<br> Mintue" & datediff("n",date," 01/01/2000 "))  response.write("<br> hour" & datediff("h",date," 01/01/2000 "))  response.write("<br> second" & datediff("s",date," 01/01/2000"))  %>
  84. 84. 1. Abs function  The Abs function returns the absolute value of a specified number.  Example  <%  Response.write (Abs(1) & “<br>”)  Response.write(Abs(-1))  %>
  85. 85.  Cos Function  The cos function returns the cosine of a specified number.  <%  Response.write(cos(50.0))  %>
  86. 86.  Exp Function  The Exp function returns e raised to a power.  <%  Response.write(exp(6.7))  %>  IntFunction  The int function returns the integer part of a number  <%  Response.write(int(6.83227))  %>
  87. 87.  Sqr Function  The sqr function returns the square root of a number.  <%  Response.write(sqr(9))  %>  Tan Function  The tan function returns the tangent of a number < %  Response.write(tan(59))  %>
  88. 88. The InStr function returns the position of the first occurrence of one string within another. <% dim a,b a="Have a Great Day Enjoy" b=instr(a,"Great") response.write(b) %> Output:8
  89. 89. The InStrRev function returns the position of the first occurrence of one string within another. The search begins from the end of string, but the position returned counts from the beginning of the string <% dim a,b a="Have a Great Day Enjoy" b=instrrev(a,"Day") response.write(b) %> Output:14
  90. 90. The LCase function converts a specified string to lowercase. dim a a=“HAVE A GREAT DAY!" response.write(LCase(a)) Output: have a great day!
  91. 91. The Left function returns a specified number of characters from the left side of a string. dim a a="This is a beautiful day!" response.write(Left(a,11)) Output:This is a b
  92. 92. The Len function returns the number of characters in a string. dim a a="This is a beautiful day!" response.write(Len(a)) Output:24
  93. 93. The Mid function returns a specified number of characters from a string. <% dim a a="Have a Great Day Enjoy" b=mid(a,8,9) response.write(b) %> Output: Great Day
  94. 94. The Replace function replaces a specified part of a string with another string a specified number of times dim a a="This is a beautiful day!" response.write(Replace(a,"beautiful","horrible")) Output:This is a horrible day!
  95. 95. The String function returns a string that contains a repeating character of a specified length. response.write(String(10,"#")) Output:##########
  96. 96.  An object is a thing or an entity like pen, table, chair, mobile phone, car etc. in other words, an object is a reusable component that contains related data and functions that represent some real-life things.  A property is a basic characteristics of an object or you can say property is a value that describe the object, like color, shape etc.  A method is something you can do with the object. In other words, method is a function which can be performed on the object. For example: 1. Pen is used for writing. 2. Chair is used for sitting.
  97. 97. Active Server Pages consist of six built in objects. They are ready made objects which provide functionality to your web pages without requiring you to make custom objects Following are the six built in ASP objects : 1. Application 2. ASP Error 3. Request 4. Response 5. Server 6. Session
  98. 98. A group of ASP files that work together to perform some purpose is called an application.
  99. 99. ASession object stores information about, or change settings for a user session. Only store SMALL amounts of data in session variables!
  100. 100.  The Response object is used to send the output back to the client (browser). It includes all the HTTP variables, cookies that will be stored on the client browser and other info about the content being sent
  101. 101. The Request object makes available all the values that client browser passes to the server during an HTTP request. It includes client browser info, cookie details ( of this domain only ), client certificates ( if accessing through SSL ) etc.
  102. 102. The ASPError object, implemented in ASP 3.0, contains detailed information about the last error that has occurred.
  103. 103.  An application on the Web may consists of several ASP files that work together to perform some purpose. The Application object is used to tie these files together.  The Application object is used to store and access variables from any page, just like the Session object. The difference is that ALL users share ONE Application object (with Sessions there is ONE Session object for EACH user).
  104. 104. The Application object holds information that will be used by many pages in the application (like database connection information). The information can be accessed from any page. The information can also be changed in one place, and the changes will automatically be reflected on all pages.
  105. 105. Store and Retrieve Application Variables Application variables can be accessed and changed by any page in an application. You can create Application variables in "Global.asa"
  106. 106. Store and Retrieve Application Variables Application variables can be accessed and changed by any page in the application. You can create Application variables in "Global.asa" <script language="vbscript" runat="server"> Sub Application_OnStart application(“cname")=“ infosys delhi " End Sub </script>
  107. 107. The Global.asa file is an optional file that can contain declarations of objects, variables, and methods that can be accessed by every page in an ASP application. All valid browser scripts (JavaScript, VBScript, PerlScript, etc.) can be used within Global.asa.
  108. 108. The Global.asa file can contain only the following: Application events Session events <object> declarations Type Library declarations the #include directive Note: The Global.asa file must be stored in the root directory of the ASP application, and each application can only have one Global.asa file.
  109. 109. In Global.asa you can tell the application and session objects what to do when the application/session starts and what to do when the application/session ends. The code for this is placed in event handlers. The Global.asa file can contain four types of events:
  110. 110. Application_OnStart - Occurs when the FIRST user calls the first page in an ASP application. This event occurs after the Web server is restarted or after the Global.asa file is edited. The "Session_OnStart" event occurs immediately after this event. Session_OnStart - This event occurs EVERY time a NEW user requests his or her first page in the ASP application.
  111. 111. Session_OnEnd - This event occurs EVERY time a user ends a session. A user-session ends after a page has not been requested by the user for a specified time (by default this is 20 minutes). Application_OnEnd - This event occurs after the LAST user has ended the session. Typically, this event occurs when a Web server stops. This procedure is used to clean up settings after the Application stops, like delete records or write information to text files.
  112. 112. <script language="vbscript" runat="server"> sub Application_OnStart 'some code end sub sub Application_OnEnd 'some code end sub sub Session_OnStart 'some code end sub
  113. 113. sub Session_OnEnd 'some code end sub </script> Because we cannot use the ASP script delimiters (<% and %>) to insert scripts in the Global.asa file, we put subroutines inside an HTML <script> element.
  114. 114. In this example we will create a Global.asa file that counts the number of current visitors. The Application_OnStart sets the Application variable "visitors" to 0 when the server starts The Session_OnStart subroutine adds one to the variable "visitors" every time a new visitor arrives
  115. 115. The Session_OnEnd subroutine subtracts one from "visitors" each time this subroutine is triggered The Global.asa file: <script language="vbscript" runat="server"> Sub Application_OnStart Application("visitors")=0 End Sub
  116. 116. Sub Session_OnStart Application.Lock Application("visitors")=Application("visit ors")+1 Application.UnLock End Sub Sub Session_OnEnd Application.Lock Application("visitors")=Application("visit ors")-1 Application.UnLock End Sub </script>
  117. 117. To display the number of current visitors in an ASP file: <html> <head> </head> <body> <p>There are < %response.write(Application("visit ors"))%> online now!</p> </body> </html>
  118. 118. The Global.asa file is contain declarations of objects, variables, and methods that can be accessed by every page in an ASP application. All valid browser scripts (JavaScript, VBScript, PerlScript, etc.) can be used within Global.asa.
  119. 119. The ASP Server object is used to access properties and methods on the server. Its properties and methods are described below: Properties Script Timeout Sets or returns the maximum number of seconds a script can run before it is terminated Methods Create Object Creates an instance of an object Execute Executes an ASP file from inside another ASP file
  120. 120. GetLastError() Returns an ASP Error object that describes the error condition that occurred HTMLEncode Applies HTML encoding to a specified string <% = Server.HTMLEncode("The paragraph tag: <P>") %>
  121. 121. MapPath Maps a specified path to a physical path <% =Server.MapPath(Request.ServerVariables("PATH_INFO")) %> Transfer Sends (transfers) all the information created in one ASP file to a second ASP file URLEncode Applies URL encoding rules to a specified string
  122. 122. ASession object stores information about, or change settings for a user session. Only store SMALL amounts of data in session variables!
  123. 123. When you are working with an application on your computer, you open it, do some changes and then you close it. This is much like a Session. The computer knows who you are. It knows when you open the application and when you close it.  Variables stored in a Session object hold information about one single user, and are available to all pages in one application.
  124. 124.  Common information stored in session variables are name, id, and preferences. The server creates a new Session object for each new user, and destroys the Session object when the session expires.
  125. 125. A session starts when: A new user requests an ASP file, and the Global.asa file includes a Session_OnStart procedure A value is stored in a Session variable A user requests an ASP file, and the Global.asa file uses the <object> tag to instantiate an object with session scope
  126. 126. The most important thing about the Session object is that you can store variables in it. The example ahead will set the Session variable username to “Shawn" and the Session variable age to “30":
  127. 127. <% Session("username")=“Shawn" Session("age")=30 %>
  128. 128. When the value is stored in a session variable it can be reached from ANY page in the ASP application: Welcome <% Response.Write(Session("username") ) %> The line above returns: "Welcome Shawn".
  129. 129. The Contents collection contains all session variables. The example ahead removes the session variable "sale" if the value of the session variable "age" is lower than 18:
  130. 130. <% If Session.Contents("age")<18 then Session.Contents.Remove("sale") End If %> To remove all variables in a session, use the RemoveAll method: <% Session.Contents.RemoveAll() %>
  131. 131. Properties SessionID The SessionID is a read-only property that uniquely identifies each current user's session. Each session has a unique identifier that is generated by the server when the session is created and stored as a cookie on the client machine. TimeOut The Timeout property sets or returns the timeout period (in minutes) for thе Session object in this application. If the user does not refresh or request a page within the timeout period,the session ends. Can be changed in individual pages as required.
  132. 132. Acookie is often used to identify a user.
  133. 133. Acookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With ASP, you can both create and retrieve cookie values.
  134. 134. The "Response.Cookies" command is used to create cookies. The Response.Cookies command must appear BEFORE the <html> tag.
  135. 135. IN THE EXAMPLE BELOW, WE WILL CREATE A COOKIE NAMED "FIRSTNAME" AND ASSIGN THE VALUE "ALEX" TO IT: <% Response.Cookies("firstname")="Alex" %>
  136. 136. IT IS ALSO POSSIBLE TO ASSIGN PROPERTIES TO A COOKIE, LIKE SETTING A DATE WHEN THE COOKIE SHOULD EXPIRE: <% Response.Cookies("firstname")="Alex Response.Cookies("firstname").Expires =#May 10,2012# %>
  137. 137. The"Request.Cookies" command is used to retrieve a cookie value
  138. 138. IN THE EXAMPLE BELOW, WE RETRIEVE THE VALUE OF THE COOKIE NAMED “FIRSTNAME" AND DISPLAY IT ON A PAGE: <% fname=Request.Cookies("firstname") response.write("Firstname=" & fname) %>
  139. 139. Communication With User
  140. 140. Form  Forms are a convenient way to communicate with visitors to your Web site.  A form on a page allows a user to enter data that is sent to a server for processing
  141. 141.  The <form> tag is used to create an HTML form for user input.  A form can contain input elements like text fields, checkboxes, radio-buttons, submit buttons and more. A form can also contain dropdown list, textarea elements.  Forms are used to pass data to a server.
  142. 142. Attributes oF Form  Action = Specifies where to send the form-data when a form is submitted  Value =“url”  Method = Specifies how to send form-data  Value = “get or post”  Name = Specifies the name for a form
  143. 143. Controls  Users interact with forms through named controls.  Each control has both an initial value and a current value, both of which are character strings.
  144. 144. Control types  The Input Element  The most important form element is the input element.  The input element is used to select user information.  An input element can vary in many ways, depending on the type attribute. An input element can be of type text field, checkbox, password, radio button, submit button, and more.
  145. 145. Attributes oF input element
  146. 146.  Text Fields  <input type="text">  defines a one-line input field that a user can enter text into it.  E.G.  <form> First name: <input type="text" name="firstname"> Last name: <input type="text" name="lastname"> </form>
  147. 147.  Password Field  <input type="password">  defines a password field:  E.G.  <form> Password: <input type="password" name="pwd" /> </form>
  148. 148.  Radio Buttons  <input type="radio">  defines a radio button. Radio buttons let a user select ONLY ONE one of a limited number of choices:  E.G  <form> <input type="radio" name="sex" value="male"> Male <input type="radio" name="sex" value="female"> Female </form>
  149. 149.  Checkboxes  <input type="checkbox">  defines a checkbox. Checkboxes let a user select ONE or MORE options of a limited number of choices.  E.G.  <form> <input type="checkbox" name="v1" value="Bike" /> I have a bike<br /> <input type="checkbox" name="v2" value="Car" /> I have a car </form>
  150. 150.  Submit Button  <input type="submit">  defines a submit button.  A submit button is used to send form data to a server. The data is sent to the page specified in the form's action attribute. The file defined in the action attribute usually does something with the received input:  <form name="input" action=“a.asp" method="get"> Username: <input type="text" name="user" /> <input type="submit" value="Submit" /> </form>
  151. 151. Pull down Lists: It is used to select one choice out of many choices. This control is very useful when we have number of choices and we have to choose only one particular choice. These lists occupy minimum amount of space. We use the <select> tag for this.  Syntax  <select name=”unique_name” size=”n”>  <option value=”any_value”>  <option value=”any_value ”>  </select>
  152. 152.  <html> <head><title>Asking for information</title></head> <body> <form method="post" action="form_response.asp"> Your name: <input type="text" name="name" size="20"><BR> Your email: <input type="password" name="email" size="15"><BR> <input type="Submit" value="Submit"> </form> </body> </html>
  153. 153.  <html> <head><title>Responding to a form</title></head> <body> Your name is <% =Request.Form("name") %> <BR> Your email is <% =Request.Form("email") %> </body> </html>
  154. 154. The Response object is used to send the output back to the client (browser). It includes all the HTTP variables, cookies that will be stored on the client browser and other info about the content being sent.
  155. 155. Redirect Redirects the browser to another page (URLe.g.Response.Redirect "http://www.gurchet.orgfree.com". Write Writes the specified string to the web page e.g. Response.Write "Hello World!".
  156. 156. The Request object makes available all the values that client browser passes to the server during an HTTP request. It includes client browser info, cookie details ( of this domain only ), client certificates ( if accessing through SSL ) etc.
  157. 157. Form Collection of all the values of Form element in the HTTP request. QueryString Collection of variables which are stored in the HTTP query string. Name / value pairs can also be appended to the URL after the end of page name e.g. "http://www.stardeveloper.com/asp_request.asp? author=Faisal+Khan" contains one variable 'author' with a value of 'Faisal Khan'.
  158. 158. Caching is a well known concept in computer science: when programs continually access the same set of instructions, a massive performance benefit can be realized by storing those instructions in RAM. This prevents the program from having to access the disk thousands or even millions of times during execution by quickly retrieving them from RAM. Caching on the web is similar in that it avoids a roundtrip to the origin web server each time a resource is requested and instead retrieves the file from a local computer's browser cache or a proxy cache closer to the user.
  159. 159. The Buffer property specifies whether to buffer the output or not. When the output is buffered, the server will hold back the response to the browser until all of the server scripts have been processed, or until the script calls the Flush or End method. Note: If this property is set, it should be before the <html> tag in the .asp file response.Buffer[=flag]
  160. 160. Response.clear Response.Flush Response.End
  161. 161. For Communicating With User We Use Forms In Form We Have Two Method For Communicating User 1. Method Post 2. Method Get Form tag provide various form fields for sending information to server. And we use these fields to communicating. Like text field to send mails
  162. 162. Another <form> tag attribute specifies how the information will be sent to wherever it's going. That's the "method" attribute. The method attribute is either method="POST" or method="GET" Which you use depends on how the destination program or function wants to receive the information.
  163. 163. Sending With Method GET method="GET" is used if you want to send information somewhere via a browser URL. You've seen URLs that send information; they look something like: http://gurchet.orgfree.com/handler.name? color=red&shape=round In the above URL, the part after the question mark is information sent to handler.name. Multiple information chunks are separated with an ampersand. The GET method can send only a limited amount of information. The limitation depends on the server where the current web page is on and the server where the information is sent to. The limitation can be as little as 256 bytes but is often 1k or more.
  164. 164. Sending With Method POST method="POST" is the most common method used to send information from a form to an information processing program or function. This is the method used when sending form information to JavaScript functions. Most CGI programs are written to accept information with the POST method, some to accept only the POST method. The POST method can send much more information than the typical GET method. Currently, most browsers and servers limit the amount of POST information to about 32k. With POST, the information is not sent via the URL. The sending is invisible to the site visitor.
  165. 165. Accessing the HTTP Headers Standard HTTP Headers Environment Variables Using Cookies Advantages & disadvantages cookies
  166. 166. When the client request a web page from the server it not only sends the url of web page requested but also send some additional information this extra information consists of useful facts about the client 1. What browser is being used 2. What operating system the client running 3. What url the user just come from These information are called request header
  167. 167. Request Header is a single line of text that your browser sends to the web Server when requesting to view any web page. Response Header when the server sends back the requested web page to the client it also sends a set of headers known as response headers. Both request headers and response headers are called HTTP Header
  168. 168. An HTTP Header is a single piece of information sent either from client To the server when requesting a page or from the server to the client when Responding to a page request. 1. HTTP_ACCEPT 2. HTTP_ACCEPT_LANGAGUE 3. HTTP_CONNECTION 4. HTTP_HOST 5. HTTP_USER_AGENT 6. HTTP_REFERER 7. HTTP_COOKIE
  169. 169. The HTTP Headers are useful for obtaining information about current Visitor but tell you nothing about the web server or asp page that is being requested by the client. To obtain such information we use web server’s Environment Variables Environment Variables are bit of information that web browser make available to any Program that requested them. It contain information such as:- 1. Name of web server 2. url currently processing asp page 3. Name of software being used by web server.
  170. 170. 1. URL 2. PATH_INFO 3. PATH_TRANSLATED 4. APPL_PHYSICAL_PATH 5. QUERY_STRING 6. SERVER_NAME 7. SERVER_SOFTWARE Many environment variables do not contain a value because it use when required for example CERT Variable contains empty strings as their value. This is because these variable are Used only when client and server use CERTIFICATES .When a browser and web Server communicate over a secure channel, certificates are used to ensure the identity of the Client to the server.
  171. 171. Cookies are small amount of information stored in client computer for some time. When cookies are created on the client computer the developer need to specify when they expire. After a cookie expire it will automatically remove itself from the client computer. Cookies created response.cookies(“user”)=“John” Cookies read request.cookies(“user”) Cookies expire response.cookies(“user”).expires=date+10
  172. 172. 1. Cookies stores on client computer so not need more space in web server 2. Save small amounts of information for very long periods of time 3. It is used to customize a user visit to your web site 1. User can choose not to accept cookies on their web browser 2. It not save large amount to date 3. It save only string, date or numeric date 4. It is not secure because if temp folder deleted it also delete all cookies
  173. 173. 1. Web is stateless ? 2. Why to maintain state ? 3. Session Object 4. Asp application object 5. Asp global.asa file 6. Events in global.asa
  174. 174. An application is said to have state if it persists information for each user. In a web site this is not the case for example if you fill out s form on A web page and then revisit the form at some time later the form fields will not contain The valued you entered earlier because web site lack state this is called stateless
  175. 175. For maintaining state asp provides many ways these ways are used to kept information Which is used in round tripping process. In asp we have build in objects and collection for maintaining state Session object and application objects are used for this purpose, cookies are also used to Maintain state
  176. 176. PITFALLS OF SESSION VARIABLES (DRAWBACKS) If user select that his system not save session then session not work Default time is 20 minute it is also big disadvantages
  177. 177. The ASPError object, implemented in ASP 3.0, contains detailed information about the last error that has occurred. This information can only be accessed through the Server.GetLastError. The ASPError object has nine read-only properties and no methods. Properties •ASP Code This property returns the error code generated by IIS. •Description The description property returns the short description of the error. •ASP Description Returns a string that contains more detailed error information than the Description property, but it is not available for all errors.
  178. 178. There are 3 main types of errors: Compile-time errors These errors are usually in the syntax of the code and stop the ASP from compiling. You may have experienced this if you left the closing ”Next” statement off of a “For” loop.
  179. 179. Runtime errors These happen when you try to execute the ASP page. For example, if you try setting a variable outside its allowed range. Logic errors Logic errors are harder to detect. The problem lies within the structure of the code, and the computer cannot detect an error. These types require thorough testing before rolling out the application.
  180. 180. 5- invalid procedure call 6- overflow 7- out of memory 11- division by zero 13- type mismatch 53- internal error 61- disk full 76- path not found 438- object not support method or property 424- object required
  181. 181. <% On Error Resume Next X = 15 Y=5 Z = 15 Response.Writes( X/Y & "<b><br>") Response.Write( X/Z & "<b><br>") If Err.Number = 0 Then response.write("no error") else Response.Write(err.number & "<br>") Response.Write(err.description) End If %>
  182. 182. Non Asp Error Error Created By Server Is Called Non Asp Error In This type Of Error Program Is Not Executated Because Server Creates Problem. Some Time Message Come – Server Not Exist Or File Not Found
  183. 183. database: A collection of related information stored in a structured format. Database is often used interchangeably with the term table A table is a single store of related information; a database can consist of one or more tables of information that are related in some way.
  184. 184. data entry: The process of getting information into a database, usually done by people typing it in by way of data-entry forms designed to simplify the process.
  185. 185. dbms: Database management system. A program which lets you manage information in databases. Lotus Approach, Microsoft Access and FileMaker Pro, for example, are all DBMSs, although the term is often shortened to 'database'. So, the same term is used to apply to the program you use to organise your data and the actual data structure you create with that program.
  186. 186. field: Fields describe a single aspect of each member of a table. A student record, for instance, might contain a last name field, a first name field, a date of birth field and so on. All records have exactly the same structure, so they contain the same fields. The values in each field vary from record to record, of course. In some database systems, you'll find fields referred to as attributes.
  187. 187. flat file: A database that consists of a single table. Lightweight database programs such as the database component in Microsoft Works are sometimes called 'flat-file managers‘ (or list managers) because they can only handle single-table databases. More powerful programs, such as FileMaker Pro, Access, Approach and Paradox, can handle multi-table databases, and are called relational database managers, or RDBMSs.
  188. 188. primary key: A field that uniquely identifies a record in a table. In a students table, for instance, a key built from last name + first name might not give you a unique identifier (two or more Jane Does in the school, for example). To uniquely identify each student, you might add a special Student ID field to be used as the primary key.
  189. 189. foreign key: A key used in one table to represent the value of a primary key in a related table. While primary keys must contain unique values, foreign keys may have duplicates. For instance, if we use student ID as the primary key in a Students table (each student has a unique ID), we could use student ID as a foreign key in a Courses table: as each student may do more than one course,
  190. 190. index: A summary table which lets you quickly look up the contents of any record in a table. Think of how you use an index to a book: as a quick jumping off point to finding full information about a subject. A database index works in a similar way. You can create an index on any field in a table
  191. 191. SQL: Structured Query Language (pronounced sequel in the US; ess-queue-ell elsewhere). A computer language designed to organize and simplify the process of getting information out of a database in a usable form, and also used to reorganize data within databases. SQL is most often used on larger databases on minicomputers, mainframes and corporate servers.
  192. 192. query: A view of your data showing information from one or more tables. For instance, using the sample database we used when describing normalisation, you could query the Students database asking "Show me the first and last names of the students Whose roll no is 90821.
  193. 193. RDBMS: Relational database management system. A program which lets you manage structured information stored in tables and which can handle databases consisting of multiple tables.
  194. 194. RECORD: A record contains all the information about a single 'member' of a table. In a students table, each student's details (name, date of birth, contact details, and so on) will be contained in its own record.
  195. 195. RELATIONAL DATABASE: A database consisting of more than one table. In a multi-table database, you not only need to define the structure of each table, you also need to define the relationships between each table in order to link those tables correctly.
  196. 196. REPORT: A form designed to print information from a database (either on the screen, to a file or directly to the printer).
  197. 197. TABLE: A single store of related information. A table consists of records, and each record is made up of a number of fields. Just to totally confuse things, tables are sometimes called relations. You can think of the phone book as a table: It contains a record for each telephone subscriber, and each subscriber's details are contained in three fields - name, address and telephone.
  198. 198. Dr. E.F. Codd, an IBM researcher, first developed the relational data model in 1970. In 1985, Dr. Codd published a list of 12 rules that concisely define an ideal relational database, which have provided a guideline for the design of all relational database systems ever since.
  199. 199. Rule 1: The Information Rule All data should be presented to the user in table form Rule 2: Guaranteed Access Rule All data should be accessible without Ambiguity (doubt). This can be accomplished through a combination of the table name, primary key, and column name.
  200. 200. Rule 3: Systematic Treatment of Null Values A field should be allowed to remain empty. This involves the support of a null value, which is distinct from an empty string or a number with a value of zero. Of course, this can't apply to primary keys. In addition, most database implementations support the concept of a nun- null field constraint that prevents null values in a specific table column.
  201. 201. Rule 4: Dynamic On-Line Catalog Based on the Relational Model A relational database must provide access to its structure through the same tools that are used to access the data. This is usually accomplished by storing the structure definition within special system tables.
  202. 202. Rule 5: Comprehensive Data Sublanguage Rule The database must support at least one clearly defined language that includes functionality for data definition, data manipulation, data integrity, and database transaction control. All commercial relational databases use forms of the standard SQL (Structured Query Language) as their supported comprehensive language.
  203. 203. Rule 6: View Updating Rule Data can be presented to the user in different logical combinations, called views. Each view should support the same full range of data manipulation that direct-access to a table has available. In practice, providing update and delete access to logical views is difficult and is not fully supported by any current database.
  204. 204. Rule 7: High-level Insert, Update, and Delete Data can be retrieved from a relational database in sets constructed of data from multiple rows and/or multiple tables. This rule states that insert, update, and delete operations should be supported for any retrievable set rather than just for a single row in a single table
  205. 205. Rule 8: Physical Data Independence The user is isolated from the physical method of storing and retrieving information from the database. Changes can be made to the underlying architecture ( hardware, disk storage methods ) without affecting how the user accesses it.
  206. 206. Rule 9: Logical Data Independence How a user views data should not change when the logical structure (tables structure) of the database changes. This rule is particularly difficult to satisfy. Most databases rely on strong ties between the user view of the data and the actual structure of the underlying tables.
  207. 207. Rule 10: Integrity Independence The database language (like SQL) should support constraints on user input that maintain database integrity. This rule is not fully implemented by most major vendors. At a minimum, all databases do preserve two constraints through SQL. No component of a primary key can have a null value. (see rule 3) If a foreign key is defined in one table, any value in it must exist as a primary key in another table.
  208. 208. Rule 11: Distribution Independence A user should be totally unaware of whether or not the database is distributed (whether parts of the database exist in multiple locations). A variety of reasons make this rule difficult to implement;
  209. 209. Rule 12: Nonsubversion Rule There should be no way to modify the database structure other than through the multiple row database language (like SQL). Most databases today support administrative tools that allow some direct manipulation of the datastructure.
  210. 210. 1.What is ADO? ADO is a Microsoft technology ADO stands for ActiveX Data Objects ADO is a Microsoft Active-X component ADO is automatically installed with Microsoft IIS ADO is a programming interface to access data in a database
  211. 211. 2.Accessing a Database from an ASP Page The common way to access a database from inside an ASP page is to: Create an ADO connection to a database Open the database connection Create an ADO recordset Open the recordset Extract the data you need from the recordset Close the recordset Close the connection
  212. 212. 3. How DSN-less Database Connection Created ? The easiest way to connect to a database is to use a DSN-less connection. A DSN-less connection can be used against any Microsoft Access database on your web site. If you have a database called "northwind.mdb" located in a web directory like "c:/webdata/", you can connect to the database with the following ASP code: <% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0“ conn.Open "c:/webdata/northwind.mdb" %>
  213. 213. 4. What is Connection Object ? The ADO Connection Object is used to create an open connection to a data source. Through this connection,you can access and manipulate a database.If you want to access a database multiple times,you should establish a connection using the Connection object. You can also make a connection to a database by passing a connection string via a Command or Recordset object. However,this type of connection is only good for one specific, single query. set objConnection=Server.CreateObject("ADODB.connection")
  214. 214. 5. What is Recordset Object ? The ADO Recordset object is used to hold a set of records from a database table. A Recordset object consist of records and columns (fields). In ADO, this object is the most important and the one used most often to manipulate data from a database. set objRecordset=Server.CreateObject("ADODB.recordset")
  215. 215. 7. How Data is Extracted from Record set After a record set is opened, we can extract data from record set. Suppose we have a database named "North wind", we can get access to the "Customers" table inside the database <% dim con set con=Server.createObject("ADODB.connection") con.open "provider=microsoft.jet.oledb.4.0;Data source="& server. mappath("db1.mdb") set rs=Server.createObject("ADODB.Recordset") q="select * from stu" rs.open q,con response.write("<table border=3 align=center height=30% width=20% > "&"<tr><th>") response.write("ID" & "</td><td>" & "<b> Name"& "</td><td>" & "<b> Marks")
  216. 216. response.write("</td></tr>") response.write("<br>") do while not rs.EOF response.write("<tr><td>") response.write(rs("id")&" " & "</td><td>") response.write(rs("name")&" " & "</td><td>") response.write(rs("marks")&" " & "</td>") response.write("<br>") response.write("</tr>") rs.movenext loop %>
  217. 217.  Recordset Object  The ADO Recordset object is used to hold a set of records from a database table. A Recordset object consist of records and columns (fields).  In ADO, this object is the most important and the one used most often to manipulate data from a database.
  218. 218. What is Recordset updating: Immediate updating - all changes are written immediately to the database once you call the Update method. Batch updating - the provider will cache multiple changes and then send them to the database with the Update Batch method.
  219. 219. 12. Define 4 different types of cursor in ADO Cursor: Database cursor is a control structure that enables traversal over the records in a database. Cursors are used by database programmers to process individual rows returned by database system queries. Types Of Cursor Dynamic cursor – Allows you to see additions, changes, and deletions by other users. Keyset cursor – Like a dynamic cursor, except that you cannot see additions by other users, and it prevents access to records that other users have deleted.
  220. 220. Static cursor Provides a static copy of a recordset for you to use to find data or generate reports. Static cursors Support scrolling backward and forward, but they do not support updates.This is the only type of cursor allowed when you open a client-side Recordset object. The following is an example of how to obtain a static cursor by using ADO.NET: cmd.CommandText = "Select * from tablename"; SqlCeResultSet rs = cmd.ExecuteResultSet (ResultSetOptions.Scrollable | ResultSetOptions. Insensitive);
  221. 221. Forward-only cursor -Allows you to only scroll forward through the Recordset. -Additions, changes, or deletions by other users will not be visible. Popular Relational Database Product SQL 7 ORACLE8 SYSBASE IBM’S DB2 INFORMIX

×