|
Subject:
|
A simple question about databases
|
|
Posted By:
|
menesesg
|
Post Date:
|
11/13/2004 10:00:41 PM
|
Hello,
I hope anybody can help me!!!
This is my first time in Databases, I am using a simple Access Database with the ODBC connection. All I am doing is to ask the user its number employee and then return the information according to its profile and allow the user to access into a certain URL, everything at this point works fine, my query is ok, and the data displays ok, but when the number employee is not in the database I want to send a message telling the user he is not subscribe, and here is my problem I don´t know how to get the method for returning the message, I mean which code I can use to do my condition if(x== "null") or something then Response.Write("Sorry, you are not subscribe"). I think this must be pretty natural but I can´t find the method to do it
Please Help me !! is all I need to finish my work.
Here is my code:
<%@ LANGUAGE="JAVASCRIPT" %> <html> <head> <title>Información general</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- .style2 { font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; color: #CC0000; } .style5 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; } --> </style> <script language="JavaScript" type="text/JavaScript"> <!--
function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } //--> </script> </head> <body> <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="5"> <TR> <TD BGCOLOR="#000066"><B><FONT FACE="Verdana, Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FFFFFF">RESULTADOS DE LA BÚSQUEDA</FONT></B></TD> </TR> </TABLE>
<% //se genera la conexión con la base de datos y se llena la lista con los resultados
var expediente = Request.QueryString("exp1"); var adoConnection = Server.CreateObject("ADODB.Connection"); var adoRecordSet; var mySQL; adoConnection.Open("DSN=PdC"); var mySQL = "SELECT Usuarios.Expediente, Usuarios.Nombre, Perfiles.DescPerf, Curricula.URL" + " FROM (Curricula INNER JOIN (Usuarios INNER JOIN Inscritos ON Usuarios.Expediente = Inscritos.Expediente) ON Curricula.Clave = Inscritos.[Puesto inscrito]) INNER JOIN Perfiles ON Usuarios.Perfil = Perfiles.Clave_perf" + " WHERE (((Inscritos.Expediente))=" + expediente + ")"; adoRecordSet = adoConnection.Execute(mySQL); // hace loop en la base y al terminar, trae los datos a la página WEB
while( adoRecordSet.Eof == false) { %> <P ALIGN="LEFT"><B><FONT FACE="Verdana, Arial, Helvetica, sans-serif" SIZE="2">Nombre: <%=adoRecordSet("Nombre").Value%></FONT></B></P> <P ALIGN="LEFT"><B><FONT FACE="Verdana, Arial, Helvetica, sans-serif" SIZE="2">Número de expediente: <%=adoRecordSet("Expediente").Value%></FONT></B></P> <P ALIGN="LEFT"><B><FONT FACE="Verdana, Arial, Helvetica, sans-serif" SIZE="2"><%=adoRecordSet("DescPerf").Value%></FONT></B></P> <img src="media/iniciar1.gif" width="82" height="36" onclick="window.location.replace('<%= adoRecordSet("URL").Value%>')"> <%
adoRecordSet.MoveNext(); } // cierra el recordset y la conexión // y libera la memoria utilizada por la rutina del Recordset y los objetos de Conexión
adoRecordSet.Close(); adoRecordSet = null; adoConnection.Close(); adoConnection = null; %> </TABLE> <p> </p> </body> </html>
Thanks in advance.
Liliana
|
|
Reply By:
|
happygv
|
Reply Date:
|
11/15/2004 2:06:32 AM
|
var mySQL = "SELECT Usuarios.Expediente, Usuarios.Nombre, Perfiles.DescPerf, Curricula.URL" + " FROM (Curricula INNER JOIN (Usuarios INNER JOIN Inscritos ON Usuarios.Expediente = Inscritos.Expediente) ON Curricula.Clave = Inscritos.[Puesto inscrito]) INNER JOIN Perfiles ON Usuarios.Perfil = Perfiles.Clave_perf" + " WHERE (((Inscritos.Expediente))=" + expediente + ")";
adoRecordSet = adoConnection.Execute(mySQL);
'Check that here.
If adoRecordSet.Eof Then
Response.write "Sorry you are not subscribed"
ELSE
// hace loop en la base y al terminar, trae los datos a la página WEB
while( adoRecordSet.Eof == false)
...
...
WEND
END IF Hope that helps. Cheers!
_________________________ - Vijay G Strive for Perfection
|
|