Mixaalser684 Posted January 18, 2008 Share Posted January 18, 2008 Which line of code I need to put in order to display boolean records from my table as YES/NO text instead of TRUE/FALSE. Which code i need to use and where to put it?Here's my code: <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%><%// *** Restrict Access To Page: Grant or deny access to this pagevar MM_authorizedUsers="1";var MM_authFailedURL="../loginfailed.asp";var MM_grantAccess=false;if (String(Session("MM_Username")) != "undefined") { if (false || (String(Session("MM_UserAuthorization"))=="") || (MM_authorizedUsers.indexOf(String(Session("MM_UserAuthorization"))) >=0)) { MM_grantAccess = true; }}if (!MM_grantAccess) { var MM_qsChar = "?"; if (MM_authFailedURL.indexOf("?") >= 0) MM_qsChar = "&"; var MM_referrer = Request.ServerVariables("URL"); if (String(Request.QueryString()).length > 0) MM_referrer = MM_referrer + "?" + String(Request.QueryString()); MM_authFailedURL = MM_authFailedURL + MM_qsChar + "accessdenied=" + Server.URLEncode(MM_referrer); Response.Redirect(MM_authFailedURL);}%><!--#include file="../../Connections/prodavnica.asp" --><%var rsKorisnici = Server.CreateObject("ADODB.Recordset");rsKorisnici.ActiveConnection = MM_prodavnica_STRING;rsKorisnici.Source = "SELECT * FROM UpitKorisnici ORDER BY UserNameKorisnika";rsKorisnici.CursorType = 0;rsKorisnici.CursorLocation = 2;rsKorisnici.LockType = 1;rsKorisnici.Open();var rsKorisnici_numRows = 0;%><%var Repeat1__numRows = -1;var Repeat1__index = 0;rsKorisnici_numRows += Repeat1__numRows;%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Prodavnica - Admin - Korisnici</title></head><body> <table width="80%" align="center"> <tr> <td colspan="2" bgcolor="#999999"> </td> </tr> <tr> <td width="70%" valign="top"><p>Administrator: Lista Korisnika </p> <p>Ispod se nalazi lista svih registrovanih korisnika </p> <p><a href="add.asp">Dodaj Novog Korisnika </a><br /> </p></td> <td width="30%" valign="top" bgcolor="#CCCCCC"><div align="center"><a href="index.asp">Korisnici</a><br /> <a href="../vrsta_naloga/index.asp">Vrste Naloga</a> <br /> <a href="../logout.asp">Logout</a></div></td> </tr></table> <table border="1" align="center" cellpadding="3" cellspacing="5"> <tr> <td><strong>RB</strong></td> <td><strong>Ime</strong></td> <td><strong>Prezime</strong></td> <td><strong>User Name</strong></td> <td><strong>Admin</strong></td> <td><strong>Allowed</strong></td> <td><strong>Nalog</strong></td> <td><strong>Email</strong></td> </tr> <% while ((Repeat1__numRows-- != 0) && (!rsKorisnici.EOF)) { %> <tr> <td><%=(rsKorisnici.Fields.Item("RBKorisnika").Value)%></td> <td><%=(rsKorisnici.Fields.Item("ImeKorisnika").Value)%></td> <td><%=(rsKorisnici.Fields.Item("PrezimeKorisnika").Value)%></td> <td><a href="edit.asp?RBKorisnika=<%=(rsKorisnici.Fields.Item("RBKorisnika").Value)%>"><%=(rsKorisnici.Fields.Item("UserNameKorisnika").Value)%></a></td> [b]<td><%=(rsKorisnici.Fields.Item("Admin").Value)%></td> - I approximately know that it needes to be done right here but I don't know how the code goes. <td><%=(rsKorisnici.Fields.Item("Allowed").Value)%></td>[/b] <td><%=(rsKorisnici.Fields.Item("Nalog").Value)%></td> <td><%=(rsKorisnici.Fields.Item("Email").Value)%></td> </tr> <% Repeat1__index++; rsKorisnici.MoveNext();}%> </table></body></html><%rsKorisnici.Close();%> Link to comment Share on other sites More sharing options...
aspnetguy Posted January 19, 2008 Share Posted January 19, 2008 <td><% if(rsKorisnici.Fields.Item("Allowed").Value == "True") { Response.Write("YES");} else { Response.Write("NO");}%></td> Link to comment Share on other sites More sharing options...
Mixaalser684 Posted January 19, 2008 Author Share Posted January 19, 2008 <td><% if(rsKorisnici.Fields.Item("Allowed").Value == "True") { Response.Write("YES");} else { Response.Write("NO");}%></td> When put this code and preview it in browser all my records automatically change to NO regardless of the data in the database. What is wrong?P.S. - I figure it out. It needs to say =="1" in my case not =="True", maybe its because I'm using Access Database. Thanx for the answer it helped a lot.Can you please also provide some tutorials where I can learn the code, but with real examples, not just theory. Thanx again. Link to comment Share on other sites More sharing options...
Mixaalser684 Posted February 14, 2008 Author Share Posted February 14, 2008 How do I need to write this code if I'm using VBScript for my ASP page? <td><% if(rsKorisnici.Fields.Item("Allowed").Value == "1") { Response.Write("YES");} else { Response.Write("NO");}%></td> I tried different combinations but I'm getting an error message all the time. Here is one of the combination I tried: <td><% if(rsKorisnici.Fields.Item("Allowed").Value = "1") Then Response.Write("YES") Else Response.Write("NO")%></td> Any help is appreciated. Thnx. Link to comment Share on other sites More sharing options...
justsomeguy Posted February 14, 2008 Share Posted February 14, 2008 <td><% If rsKorisnici.Fields.Item("Allowed").Value = "1" Then Response.Write("YES")Else Response.Write("NO")End If%></td> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.