Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 13th, 2004, 11:00 PM
Registered User
 
Join Date: Jun 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to menesesg
Default A simple question about databases

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>RESULTADOS DE LA B&Uacute;SQUEDA</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>Nombre: <%=adoRecordSet("Nombre").Value%></B></P>
<P ALIGN="LEFT"><B>Número de expediente: <%=adoRecordSet("Expediente").Value%></B></P>
<P ALIGN="LEFT"><B><%=adoRecordSet("DescPerf").Value% ></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
 
Old November 15th, 2004, 03:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Code:
    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





Similar Threads
Thread Thread Starter Forum Replies Last Post
not at all simple question petergoodman XSLT 0 July 18th, 2008 08:37 AM
simple question petergoodman XSLT 8 July 18th, 2008 07:57 AM
Question on saving changes to databases PatCiferri SQL Server 2005 1 December 4th, 2007 04:56 PM
Very Simple Question YoungLuke C# 2 May 4th, 2007 02:23 AM
Beginning C# Databases question BrentZ Forum and Wrox.com Feedback 1 November 4th, 2003 11:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.