English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

%@ Language=VBScript %>





<%
dim con,rs,no,str
no=LCASE(Request.Form("regno"))
set con=server.CreateObject("ADODB.Connection")
set rs=server.CreateObject("ADODB.RecordSet")
con.Open "Provider=MSDAORA.0;Data Source=college; User Id=scott;password=tiger"
str = "select * from studentdata where idno='" & no & "'"
rs.Open str,con,3,3
if rs.EOF = true and rs.BOF=true then
Response.Write("Invalid Reg No")
else %>







Id no
<%=rs.Fields(0) %>
Name
<%=rs.Fields(1) %>
E-Mail Id
<%=rs.Fields(2) %>
Date of Birth
<%=rs.Fields(3) %>
Blood Group
<%=rs.Fields(0) %>


<% end if
rs.Close
con.Close
set rs=nothing
set con=nothing
%>






i need the meaning of these statments

set con=server.CreateObject("ADODB.Connection")
set rs=server.CreateObject("ADODB.RecordSet")
con.Open "Provider=MSDAORA.0;Data Source=college; User Id=scott;password=tiger"
str = "select * from studentdata where idno='" & no & "'"
rs.Open str,con,3,3
if rs.EOF = true and rs.BOF=true then
Response.Write("Invalid Reg No")

2007-06-03 17:11:24 · 3 answers · asked by @nu 2 2 in Computers & Internet Programming & Design

3 answers

set con=server.CreateObject("ADODB...

' creates a connection to the database with ADO (Active-X data objects)

set rs=server.CreateObject("ADODB....

' Creates an ADO recordset to hold the results of teh database query

con.Open "Provider=MSDAORA.0;Data Source=college; User Id=scott;password=tiger"

' connects to an Oracle database with the well-known out-of-the-box Oracle username/passwords.

str = "select * from studentdata where idno='" & no & "'"

' creates SQL command and puts the value of no in the where clause

rs.Open str,con,3,3

' open the database connection and execute the SQL command in str

if rs.EOF = true and rs.BOF=true then

' if query did not return records

Response.Write("Invalid Reg No")

' write the message to the HTML stream

-------

ASP is pretty old and not easy to work with. Your program is fairly short so it should be manageable. Looks like this was developed with Visual Interdev 6, part of Visual STudio 6

2007-06-03 17:19:07 · answer #1 · answered by Anonymous · 0 0

set the variable con to be an object representing a connection
set the variable rs to be a result-set for a query (database question)
connection open will open the connection to the site
str assign a string to query the database
result-set open will return the result of the query using the query string
if the result return empty that is the end-of-file and beginning-of-file are then same then display the error message on the page with a write
If there is no error then display the table

there is actually no need to check the beginning-of-file

2007-06-03 17:24:16 · answer #2 · answered by little sunbeam 3 · 0 0

Those are standard ASP server objects. I'd suggest you take a look at

learnasp.com

Basically, con is a connection variable, and rs is a resultset from an SQL query from a connection.

The if statement basically says if nothing came back (resultset is empty, since it's both at beginning of file AND end of file) give you "invalid". Else, it outputs the result of the query.

2007-06-03 17:20:11 · answer #3 · answered by Kasey C 7 · 0 0

fedest.com, questions and answers