Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Old 06-24-2004, 02:46 PM Splash Screen
Junior Talker

Posts: 1
Trades: 0
Hi:

I have a splash screen on my webpage that is used to display system maintenance notification. I have a table in SQL database that has 2 fields-Flag(bit) and Description(varchar). This table is linked to the webpage and the data in the description field is displayed on the splash screen. All this works fine.
My problem is that I want to display the splash screen only when then flag field is set to 1 in the table. So couple of days before maintenance our network administrator can go to the database and change the flag and description accordingly..instead of doing it on the webpage. But I am having trouble doing that. I would really appreciate any help. I am posting the code below.

<%@ Language=VBScript %>
<% OPTION EXPLICIT %>
<%
dim sMessage

' Make connection to SQL database

dim dbc, rs
set dbc = CreateObject( "ADODB.Connection" )
dbc.Open Application("ConnectionString"), Application("login"), Application("password")

set rs = dbc.Execute( "SELECT Flag, Description FROM tblNotification")

dim Flagstatus
Flagstatus = rs("Flag")

sMessage = ""
if Flagstatus = "True" then
sMessage = rs("Description")
end if
dbc.Close()
%>

<HTML>
<HEAD>

<script language="JavaScript1.2">
//code for Splash Screen goes in here
</script>

</HEAD>
<body style="margin-top:5px" onHelp="KeyCancel()" onKeyDown="KeyCancel()" onKeyUp="KeyHandler()">
<FORM class="menu" name=theform action='<%=Request.ServerVariables("SCRIPT_NAME")% >' method="POST">
</FORM>

<div id="dropin" style="position:absolute;visibility:hidden;left:20 0px;top:100px;width:400px;height:200px;background-color:#FF3333">
<div align="right"><a href="#" onClick="dismissbox();return false"><font color="#FFFFFF">[Close
Box]</font> </a></div>

<div align="center">
<p><font color="#FFFFFF"><strong>ODS SYSTEM MAINTENANCE NOTIFICATION</strong></font></p>
<!-- Display Description from SQL database-------->
<p> <%=sMessage%>

</p>
</div>
</div>
</BODY>
</HTML>

-gems
gems is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-24-2004, 10:16 PM
ACW
Average Talker

Posts: 26
Trades: 0
I don't know if you are getting an error but at first glance I would think that you are getting a type mismatch error on this line: if Flagstatus = "True" then

If you are getting that error or your problem is that the message is just not displaying try changing it to: if Flagstatus = True then

You can also try: if Flagstatus = 1 then

Hope this helps.
ACW is offline
Reply With Quote
View Public Profile
 
Old 06-24-2004, 11:01 PM
Kyrnt's Avatar
The Post-Mod Years

Posts: 2,536
Location: Western Maryland
Trades: 0
ACW, the check on Flagstatus is correct because the comparison is with a string out of the recordset.

gems, exactly what "kind of trouble" are you having. Specifically, what is your error?
__________________
—Kyrnt
Kyrnt is offline
Reply With Quote
View Public Profile Visit Kyrnt's homepage!
 
Old 06-24-2004, 11:15 PM
ACW
Average Talker

Posts: 26
Trades: 0
Quote:
Originally Posted by gems
I have a table in SQL database that has 2 fields-Flag(bit) and Description(varchar).
I thought it would produce an error because the flag was a bit.
ACW is offline
Reply With Quote
View Public Profile
 
Old 06-24-2004, 11:51 PM
Kyrnt's Avatar
The Post-Mod Years

Posts: 2,536
Location: Western Maryland
Trades: 0
Quote:
Originally Posted by ACW
I thought it would produce an error because the flag was a bit.
ACW, Hmm, I'm not aware of what table you mean. Is that true for all tables or just your table? That is not a feature of ADO recordsets as I am aware.

If not, if the table simply has a column called flag and it is pulled out of a recordset, it will be a string.

That said, I can't say definitively so I throw the ball back to gems. Gems, are you checking a column name there? That's the way the syntax looks to me.
__________________
—Kyrnt
Kyrnt is offline
Reply With Quote
View Public Profile Visit Kyrnt's homepage!
 
Old 06-25-2004, 10:20 AM
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
The field your checking, flagstatus, is a bit.. witch holds 1 or 0. Your checking for the literal value of "true". You just need to remove the quotes.
Code:
if Flagstatus = True then 
    sMessage = rs("Description")
end if
Anacrusis is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Splash Screen
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18796 seconds with 12 queries