I can not enter my blog. Nothing works at all! What to do?
ASP web-programming
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

QAIX > ASP web-programmingGo to page: « previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | next »

  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:
Thursday, 7 August 2008
How do you know what this group is about? Phpbaby3 21:38:08
 Is inetserver a term whose meaning you know and it is of interest?

How did you learn about the existance of this group?

Thanks!

Add comment
ASP/Java Paulmitchell507 18:40:54
 I am not sure if this should be posted in a Java newsgroup or not, I
am sure I will be told where it should be! I have a small
asp(classic) app that runs the following java script to display a drop
down list containing usernames from a access 2k database.

<html>
<head>
<title>Example combo box</title>

<script language="javascrip­t">
<!--

function dept_onchange(frmSe­lect) {
frmSelect.submit();­
}

//-->
</script>
</head>
<body>
<form name="frmSelect" method="Post" action="select.asp"­>
<SELECT name=courses LANGUAGE=javascript­ onchange="return
dept_onchange(frmSe­lect)">
<%
Set oRs=Server.CreateOb­ject("adodb.recordse­t")
strSQL = "SELECT Status_ID, Staff_ID, firstlastName FROM staff WHERE
Status_ID=1 Or Status_ID=19 ORDER by firstlastname"
oRs.Open strSQL, conn

Do while not oRs.EOF
if Request.Form("cours­es") = oRs("firstlastName"­) then 'if this is
the selected one then display as selected
Response.Write "<OPTION VALUE = '" & oRS ("staff_ID") & "'
SELECTED>"
Response.Write oRs("firstlastName"­) & "</Option>"
oRs.MoveNext
else
Response.Write "<OPTION VALUE = '" & oRs ("Staff_ID") & "'>"
Response.Write oRs("firstlastName"­) & "</Option>"
oRs.MoveNext
end if
loop

This works, to the point where it puts the value of staff_ID into
request.form("cours­es"). What I would like to do is store the
"Group_ID" values also. Please could somebody provide the code to
store the additional value. I then post the 2 values to a another asp
page for insertion into another table in the database.

Regards.
comment 2 answer | Add comment
How to free (file) resources after closing the browser Sebastian Fr nk 16:57:29
 How can I free all file resource without waiting for the garbage collector
to cleanup?

Visual Studio 2008
Visual Studio Development Server
Vista 64-bit

comment 2 answer | Add comment
Operation is not allowed when the object is closed. Isaac2004 14:14:35
 hi i am trying to use the record count object to count the number of
books in a database of mine. i get this error saying that i have closed
the object and i dont think i closed it. here is my code

<% dim strBrowse, strSearch, Count


Count = objRS.RecordCount

strBrowse = request.querystring­("strBrowse")
strSearch = request.querystring­("strSearch")

if strBrowse > "" then
strSQL = "SELECT distinctrow tblCategories.strCa­tegory,
tblBookDescription.­ISBN, tblBookDescription.­strTitle,
tblBookDescription.­strDescription " & _
"FROM tblBookDescription INNER JOIN tblCategories ON
tblBookDescription.­ISBN = tblCategories.ISBN " & _
"Where (((tblCategories.st­rCategory) = '" & strBrowse &
"')) " & _
"ORDER BY tblBookDescription.­strTitle "

End If
if strSearch > "" then
strSQL= "SELECT distinctrow tblBookDescription.­strTitle,
tblBookDescription.­strDescription, tblBookDescription.­ISBN " & _
"FROM tblAuthors INNER JOIN (tblBookDescription­ INNER JOIN
tblAuthorsBooks ON tblBookDescription.­ISBN = tblAuthorsBooks.ISB­N) ON
tblAuthors.AuthorID­ = tblAuthorsBooks.Aut­horID "&_
"WHERE ((tblAuthors.strLas­tName Like '%"&strSearch&"%') "& _
"OR (tblAuthors.strFirs­tName Like '%"&strSearch&"%') "&_
"OR (tblBookDescription­.strTitle Like '%"&strSearch&"%') "&_
"OR (tblBookDescription­.strDescription Like '% "&strSearch&"
%') "& _
"OR (tblBookDescription­.strPublisher Like '%"&strSearch&"%'))­
"&_
"ORDER BY tblBookDescription.­strTitle;"
end if

'response.write("st­rSQL = " & strSQL)

Set objRS = Server.CreateObject­("ADODB.Recordset")
-------------------­--------------------­--------------------­------------------er­ror
here
objRS.open strSQL, objConn, 1, objRS.RecordCount



%>
</td>
<td valign="top"><font face="Comic Sans MS" color="blue">
<%
if strBrowse > "" and Count = 1 then
response.write("We Carry " & Count & " " & strBrowse & "
book.")
else if strBrowse > "" and Count > 1 then
response.write("We Carry " & Count & " " & strBrowse & "
books.")
end if
end if

if strSearch > "" and Count = 1 then
response.write("Sea­rch results: " & Count & " book matches '"
& strSearch & "'.")
else if strSearch > "" and Count > 1 then
response.write("Sea­rch results: " & Count & " books match '" &
strSearch & "'.")
end if
end if


%>


thanks for the help

comment 4 answer | Add comment
Classic ASP question Mike P 11:35:16
 I have very little experience of Classic ASP, but I need to take some
data from a table, write it to the screen in a tabular format, show a
check box at the end of every row, and write some code to enable the
user to check all check boxes, and then some code to respond to a button
click to find out which rows were checked.

I know how to read data from a recordset and put it into a <table>
object, but the rest, particularly the check box bits, are giving me
problems. Can somebody please help me out?






*** Sent via Developersdex http://www.develope­rsdex.com ***
comment 5 answers | Add comment
transparent redirection in asp Rvj 11:18:12
 
if you redirect on an IIS , must the client url address bar always be
updated with the new address. what options are?


Q1 if a user requests http://old.com , is there a method of ASP
redirection to http://new.com
which does not update the client browser's address bar

Q2 ... or is this one of the main benefits of the IIS URL rewriter ??

Q3 and am I correct in thinking that search engines would only contain
indexes for http://old.com


comment 19 answers | Add comment
asp.net integration with Sharepoint Server 2007 possibilities Alvin 01:03:55
 I'm new to both asp.net development and sharepoint 2007. I was wondering if
it was possible to design an asp.net application first as a standalone web
application and later integrate it with sharepoint when funds become
available. The type of applications I'm looking to create are the simple
standard data entry screens (master-detail style) and using SQL Server
Reporting Services as the reporting solution. I have looked at Infopath
forms (maybe too simple) as well as webparts for SP (could be bloated over
time?) but neither option really appealled to me.

comment 1 answer | Add comment
Wednesday, 6 August 2008
Official User Agent Format? Toni 22:55:25
 I've got a simple ASP script that logs access to a particular file. The access log is
just a simple comma-delimited text file.

I've been looking, but I can't find this info: what are the specifications for what a
User Agent string can or cannot contain?

I am PARTICULARLY interested in if a UA string is allowed to contain a comma ",". (I'm
hoping that they cannot).

Can anyone point me to a resource that will tell if a User Agent string can - or
CANNOT - contain a comma?

Thanks so much!

Toni


comment 2 answer | Add comment
Getting info from Drop Down Emma 22:29:01
 
I'm trying to use a drop down list for the user to select an entery which
will goo back to the database and grabs what the user selects then outputs a
list using ConnectDatabase.asp­. The problem is I don't know how to make input
tags for a drop down? Hi I have a html file with the following:

<form name "input" action "ConnectDatabase.as­p" method "get">

<select>BedroomSize­
<optgroup label="Bedroom Size">
<option value = "Bachelor"> Bachelor </option>
<option value = "Room / Share"> Room / Share
</option>
<option value = "1"> 1</option>
<option value = "2"> 2 </option>
<option value = "3">3 </option>
<option value = "4"> 4 </option>
<option value = "5+"> 5+ </option>

</optgroup>
</select>
<input type="submit" value="Submit">
</form>

And I have an .asp file with the following
<%
Option Explicit
Response.Expires = -1000

Dim oConn
Dim oRS
Dim sSQL
Dim sColor


Set oConn = Server.CreateObject­("ADODB.Connection")­
oConn.Open("Provide­r=Microsoft.Jet.OLED­B.4.0; Data Source=" &
Server.MapPath("\Em­ilyLeeParsons\db\HHC­DataBase.mdb"))

sSQL = "SELECT DatePosted, Area, NearestIntersection­, HousingType,
BedroomSize, Rent, Details FROM TblHousing"
Set oRS = oConn.Execute(sSQL)­

Response.Write("<ta­ble border=1 cellpadding=1 cellspacing=1
style='font-family:­arial; font-size:10pt;'>")­
Response.Write("<tr­ bgcolor=black style='color:white;­'><td>DatePosted</td­>")
Response.Write("<td­>Area</td>")
Response.Write("<td­ align=right>Nearest­Intersection</td>")
Response.Write("<td­>HousingType</td>")
Response.Write("<td­ align=right>Bedroom­Size</td>")
Response.Write("<td­ align=right>Rent</t­d>")
Response.Write("<td­>Details</td></tr>")­

sColor = "white"

Do While NOT oRS.EOF

If sColor = "silver" Then
sColor = "white"
Else
sColor = "silver"
End If

Response.Write("<tr­ bgcolor='" & sColor & "'>")
Response.Write("<td­>" & oRS("DatePosted").V­alue & "</td>")
Response.Write("<td­>" & oRS("Area").Value & "</td>")
Response.Write("<td­>" & oRS("NearestInterse­ction").Value & "</td>")
Response.Write("<td­>" & oRS("HousingType").­Value & "</td>")
Response.Write("<td­>" & oRS("BedroomSize").­Value & "</td>")
Response.Write("<td­ align=right>$" & oRS("Rent").Value & "</td>")
Response.Write("<td­ align=right>" & oRS("Details").Valu­e & "</td></tr>")

oRS.MoveNext

Loop

Response.Write("</t­able><br><br>")

oConn.Close
Set oRS = Nothing
Set oConn = Nothing

%>


How do I get the information from the html page drop down to the asp page?
comment 2 answer | Add comment
RE: Path=Server.MapPath Steven Cheng 09:54:07
 Hi Betty,

From your descrpition, you ocassionally get some error at the
"Server.MapPath" call in your ASP application ,correct?

According to the codesnippet you provided, the Server.MapPath parameter is
concatenated via several string. As you said "sCerPath" is always
fixed(from environment variable), then the only part may vary is the
"order_id" variable, correct?

I've performed some research, it seems some possible causes is the path
contains some illegal characters, you can check the following thread:

http://www.xlinesof­t.com/asprunnerpro/a­rticles/servermappat­h_use_strategy.ht
m

Also, a kb article mentioned the ".." parent path code is not allowed in
Server.MapPath.

http://support.micr­osoft.com/?id=332117­

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.co­m.

===================­====================­===========
Get notification to my posts through email? Please refer to
http://msdn.microso­ft.com/subscriptions­/managednewsgroups/d­efault.aspx#notif
ications.

===================­====================­===========
This posting is provided "AS IS" with no warranties, and confers no
rights.------------­--------

From: =?Utf-8?B?YzY3NjIyO­A==?= <betty@newsgroup.no­spam>
Subject: Path=Server.MapPath­
Date: Tue, 5 Aug 2008 14:52:15 -0700

Hi all,
I have one line code in my program, occasionaly I will receive the
following
error:
"The Path parameter for the MapPath method did not correspond to a known
path"
Path=Server.MapPat­h(sCertPath & "\" & order_id & ".pdf")
I am wondering what is happening since every time I check my error log,
the
order_id value is not empty and sCertPath is a system variable.
Why does Server.Mappath fail?
can you share a hint?
--
Betty

comment 1 answer | Add comment
Monday, 4 August 2008
CDOSYS send email with ASP Paulmitchell507 16:19:48
 I have a file called email2.asp which I am using to mail data obtained
from a SQL query. I would like to pass the holiday_ID value in the
querystring attached to the end of the URL. It all works except that
I can't get the value of holiday_ID included as a querystring. As a
test I can insert a value after the ?id= and this is passed as a
querystring.

I am sure it's just the syntax that I am having problem with


<%
Option Explicit
<!--#include file="admin_navigat­ion.asp" -->

'Declare variables
Dim sch, cdoConfig, cdoMessage, holiday_ID, email, auth
holiday_ID = Request.Form("mynam­e")
sch = "http://schemas.mic­rosoft.com/cdo/confi­guration/"

Set cdoConfig = CreateObject("CDO.C­onfiguration")

With cdoConfig.Fields
'Set CDO Port
.Item(sch & "sendusing") = 2
'Set mailserver name either IP address, mail.yoursite.com or
localhost
.Item(sch & "smtpserver") = "192.156.217.6"
'Set SMTP port which is 25 by default
.Item(sch & "smtpserverport") = 25
'Set number of seconds before timeout
.Item(sch & "smtpconnectiontime­out") = 60
.update
End With

Set cdoMessage = CreateObject("CDO.M­essage")

With cdoMessage
Set .Configuration = cdoConfig
.From = "administrator@doma­in.com"
.To = "paul@ndomani.com"
.Subject = ""& email
'Send the email in HTML format
.HTMLBody = "<a href='http://192.15­6.217.134/authorise.­asp?
id=holiday_ID'>dele­te record</a><br><br>"­
.Send
End With

Set cdoMessage = Nothing
Set cdoConfig = Nothing
%>
comment 5 answers | Add comment
Worldpay integration in classic asp Sajit 14:53:46
 Hi folks,

Currently I am developing a shopping cart in which i need worldpay
integartion. I also want customer to be redirected to my web site
after transaction. Worldpay also provide default pages for that
purpose but i need a customized page on which customer will be
redirected after transaction. So do any one have a code snippet which
can assist me in integration.


Any help is appreciated.
Sajit Nayar.

Add comment
programmaticaly changing the default directory page Rvj 10:45:30
 Anyone know if its possible to create an ASP script to reset the default
page of a particular directory


comment 4 answer | Add comment
CDOSYS SMTP MM User 00:42:53
 Hi,

I'm using CDOSYS for sending out emails, while designing my asp pages
locally I need to set the server to localhost, however for production I need
to set it to our smtp server (smtp.companyname.c­o.uk) is there a way to set
IIS to use the smtp server ?

Thanks

comment 1 answer | Add comment
Sunday, 3 August 2008
CDO Message attachment rename Yosi 01:12:40
 Hi All

I have recently changed my send email vbscript to work on W2K3 and I am now
using the CDO.Message object. I need to rename files attached to the email
without copying / renaming the file itself. With the old CDONTS.NewMail
object I used in w2k, this was achieved with AttachFile (FilePath,
NewFileName).

There doesn't appear to be a similar function with CDO so I was wandering if
anyone had found a function or a way of doing it.

Many thanx in advance
Yosi


comment 2 answer | Add comment
Saturday, 2 August 2008
Display Records in certain order (string contained in field) Randy 23:59:05
 Just can't figure out how to do this..........
I have a simple asp page that desplays images from database.

The query on my page:
-------------------­------
imagequery = "SELECT * FROM FILE_LIST WHERE CLASS_ID=" & FORM_ID
-------------------­-----
The table FILE_LIST contains a field called TITLE which never gets
displayed.
(the form_id comes from a selection on previous page)
I display the images with a do loop as follows:
-------------------­--------
<%
set rstemp=conntemp.exe­cute(imagequery)
If rstemp.EOF Then
Form_file_ID = 0
Else
do while not rstemp.eof
%>
<CENTER><IMG SRC="imagehelper.as­p?FILE_id=<% = rstemp("FILE_id")
%>"></CENTER>
<%
rstemp.movenext
loop
END IF
rstemp.close
set rstemp=nothing
%>
-------------------­-------
I want to have the images that have the string 'photo' within the 'TITLE'
field disply FIRST
(eg. one with the title 'A photo of a cat' would desplay before 'A drawing
of a Cat' )
and THEN the ones that don'tt. I think I can accomplish this some kind of
if statement in the loop,
but I just cant get it to work without the ones containing 'photo'
displaying twice.
I hope I've explained this adequately.
Thanks in advance to anyone who has any ideas.


comment 3 answer | Add comment
Creating html file from news feed or text file Ellie 22:57:07
 I need to be able to get a feed and then have it displayed on my website.
I'm not sure if I can get the feed, but if I can, what would be the best way
to create a web page from the feed? Also, if I can't get the feed, I can get
daily email updates of google group posts. If I have the email, how could I
get that on the webserver so that the web page can display it's contents?
I'm very new at asp and I'm just starting to do my research now so I'm not
even sure my questions make sense. I've tried to do searches on feeds and
nothing seems to be helpful. To make matters worse, the group that I
subscribe to requires that you be a member and I haven't been able to access
it using googlereader as the search for that news feed comes up as not
found. Any help would be greatly appreciated. Ellie


comment 1 answer | Add comment
Thursday, 31 July 2008
ASP Development server stopped working after xampp install Somerandomperson 19:35:25
 I installed and configured XAMPP using this link
http://drupal.org/n­ode/161975 and my ASP Development server in Visual studio
2005 atopped working. I unistalled XAMPP after I found out about the problem
but my ASP server still isn't working. Any advice to get it working again?
Thanks
somerandomperson
comment 1 answer | Add comment
Easy Question for "Someone" who knows ASP. Samadams 2006 04:48:00
 Hello,

I haven't done much programming in .asp and was wondering if someone
could provide me with some sample code to do the following task...

I have a Web Service called:

http://abc.def.com:­8088/wsABC.asmx

It has a Web Method called:

public string getReportId(string sKey)
{
<code>
return sValue
}

When you call this Web Method with an input string (ie: sKey) it will
return (in the form of a string) an sValue.

I would like this classic asp (ie: test.asp) to consume this web
service and method, and pass an example "Key" to it, and return the
sValue.

I would then like to "append" this sValue on the end of another URL I
have, namely:

http://reports.def.­com:8088/Reports/asp­/ReportView.asp?id=1­23

(where 123 is the sValue in this case)

and redirect (via Http Redirect) to this ReportView.asp

I believe this is quite simple for all you knowledgeable folks. I'm
just not too versed in regular .asp, and am getting a lot of compile
errors as the debug environment I have is almost non-existent.

Also, is there an easy way to read the values of these URL's from a
Web.config file?

THANKS so much in advance to all you "gurus"...

comment 1 answer | Add comment
Wednesday, 30 July 2008
Need help with SQL injection proof recordset Update code EdG 20:44:20
 Hi All,

Our website (developed by a 3rd party) was recently hit by an Sql injection
attack and I have been going through and hardening the code. It uses asp and
talks to a sql server 2000 backend for a bunch of the page content.

I have been switching over to using parameterized queries by creating
Command Objects etc, and this has been straightforward for the most part, but
I have a piece of code that uses a recordset Update command to take some form
info and put it into the database. I am struggling to find a solution for
this.

The code is of the following form:

Set cConn = getDatabaseConn()
Set cRS = Server.CreateObject­("ADODB.RecordSet")

cRS.Open "PageContent",cConn­,2,2
cRS.AddNew
cRS("PageName") = request.form("itemN­ame")
cRS("Category") = request.form("categ­ory")
cRS("Content") = Request.Form("pageB­ody")
cRS.Update
cRS.Close
closeDatabaseConn(c­Conn)


If this was a Sql statement like "Update Table Set Field = ?, where id =?",
I would construct a parameterized query with a command object.

Is there a way of doing this with a recordset update command?

Thanks for any assistance.
comment 10 answers | Add comment
AccessCheckException Matt T 20:04:01
 I'm getting a new error when deploying my website to the server. This works
fine locally and has worked fine up until today. Any suggestions? The error
is-

AccessCheckExceptio­n
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details:
System.ServiceModel­.FaultException`1[[System.ServiceModel.ExceptionDetail,
System.ServiceModel, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]: AccessCheckExceptio­n

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:


[FaultException`1: AccessCheckException]
System.Runtime.Remo­ting.Proxies.RealPro­xy.HandleReturnMessa­ge(IMessage
reqMsg, IMessage retMsg) +2668969
System.Runtime.Remo­ting.Proxies.RealPro­xy.PrivateInvoke(Mes­sageData&
msgData, Int32 type) +717
SAM.ISimonAccess.Ca­nRun(String applicationName, String u42, String
function) +0
SAM.SimonAccessClie­nt.CanRun(String applicationName, String u42, String
function) +25
MasterPage.Page_Loa­d(Object sender, EventArgs e) +447
System.Web.Util.Cal­liHelper.EventArgFun­ctionCaller(IntPtr fp, Object o,
Object t, EventArgs e) +15
System.Web.Util.Cal­liEventHandlerDelega­teProxy.Callback(Obj­ect sender,
EventArgs e) +33
System.Web.UI.Contr­ol.OnLoad(EventArgs e) +99
System.Web.UI.Contr­ol.LoadRecursive() +47
System.Web.UI.Contr­ol.LoadRecursive() +131
System.Web.UI.Page.­ProcessRequestMain(B­oolean
includeStagesBefore­AsyncPoint, Boolean includeStagesAfterA­syncPoint) +1436




-------------------­--------------------­--------------------­--------------------­-
Version Information: Microsoft .NET Framework Version:2.0.50727.1­433;
ASP.NET Version:2.0.50727.1­433
comment 1 answer | Add comment
How to upload a file to 2 FTP sites without an upload component for company Laphan 17:52:16
 Hi All

I can't get round this because it's a local government thing, but I've done
a CMS for a school (in ASP classic) that allows them to upload gifs, jpgs,
pdfs and docs to their site for the usual CMS stuff.

Works fine on my host as I use ASPupload and I have one FTP location for my
data, but I've now found out that I've got to put the site on the local
government's servers and they only provide the following setup:

1) No ASP components such as ASPupload. They say I can do it in ASP.net as
standard, but they can't give me any example code on how to do this!!! Any
ideas bearing in mind that I upload the file and then update an SQL DB with
the file info?

2) They have 2 FTP locations for 1 site (no mirroring) so a user normally
uploads the same content to 2 locations. This is no good for me as it's
50/50 as to whether the user uploads the file via my CMS to FTP site 1 or 2
and then 50/50 as to whether the visitor sees the content from FTP site 1 or
2. I cannot get them to alter this setup, even though I think it is crap,
so do you know of a way where I can upload the file to these 2 locations
simultaneously???

Thanks



comment 6 answers | Add comment
RE: Noise and Thesaurus UDF Old Pedant 12:16:42
 

"Dooza" wrote:

Can anyone help me create a function that will accept a string of words,
then remove any that are listed in a noise word table, add any that
match in the thesaurus table, and returned to whatever called it?

Doesn't sound overly hard. In what language? How big are the tables?

I hope you don't mean SQL. You could do it, but it would be ugly as sin.

OR.... If you are talking about SQL Server, and you are using SQL Server
2005 or later (even Express edition), you might consider writing the code in
C# or VB.NET and using a CLR-based SP.

Ehhh...I guess it wouldn't be *THAT* hard to write in old-fashioned T-SQL,
but it sure wouldn't be fast, I'm guessing.




comment 1 answer | Add comment
Re: Show 0 if recordset value is null Mangler 10:33:34
 ISNULL(SUM(JBESRecei­pients) ,0)
comment 1 answer | Add comment
Serious help needed - Calendar! William 03:35:00
 Please, if you have the time and knowledge to help me I'd truly
appreciate it!
I need to build a calendar page that displays available/unavailab­le
info from a DB and colour a cell according to that info, but somewhere
I've gone completely off the rails! Basically it is a room
availability page for an intranet and should simply colour a calendar
cell red if the room is booked, or green if it isn't. Rooms are
typically booked by lecturers for multiple days or even weeks, so only
the start and end dates are entered into the calendar.
My code doesn't get all the info and I'm pulling hair out with
frustration!

Anyway, here's the code:

<!--#include file = "datacon.asp"-->
<%CODEPAGE="1252"
Dim MyMonth 'Month of calendar
Dim MyYear 'Year of calendar
Dim FirstDay 'First day of the month. 0 = Sunday
Dim CurrentDay 'Used to print dates in calendar - Day only, otherwise
same as varDateNow
Dim Col 'Calendar column
Dim Row 'Calendar row

'======
Dim RoomCI 'Start booking
Dim RoomCO 'End booking

Dim varBackground 'cell background colour
Dim varDateNow 'Current full date ---> Not actual date, but date
calendar cell is working with


Dim var1stBack


MyMonth = cint(Request.Querys­tring("Month"))
MyYear = cint(Request.Querys­tring("Year"))

If MyMonth = 0 then MyMonth = Month(Date)
if MyYear = 0 then MyYear = Year(Date)

Call ShowHeader (MyMonth, MyYear)

FirstDay = WeekDay(DateSerial(­MyYear, MyMonth, 1)) -1
CurrentDay =
1 '------------------­--------------------­--------------------­--------------------­--
Start CurrentDay on 1
'==================­===============
varDateNow = Trim(Currentday) & "/" & Trim(MyMonth) & "/" &
Trim(MyYear)
varDateNow = CDate(varDateNow)
'==================­===============
Dim var1stDay
var1stDay = "01" & "/" & Trim(MyMonth) & "/" & Trim(MyYear) 'We need
to start looking at the 1st of the month
var1stDay=CDate(var­1stDay) 'Change the variable to a proper date



'Let's build the calendar
dim varCDay
varBackground = "green" 'Default starting background colour
For Row = 0 to 5
rscal = ""
rsCal1 = ""
For Col = 0 to 6
If Row = 0 and Col < FirstDay then

response.write "<td>&nbsp;</td>"
elseif CurrentDay > LastDay(MyMonth, MyYear) then
response.write "<td>&nbsp;</td>"
else

'==================­====================­==================
'This section formats varDateNow
Dim varCurrentDay 'CurrentDay reformatted to always have 2 char's
Dim TotalDays
Dim TotalDate
Dim HouseName

'==================­===================
If CurrentDay < 10 and MyMonth >= 10 then varDateNow = "0" &
Trim(Currentday) & "/" & Trim(MyMonth) & "/" & Trim(MyYear)
If CurrentDay < 10 and MyMonth < 10 then varDateNow = "0" &
Trim(Currentday) & "/" & "0" & Trim(MyMonth) & "/" & Trim(MyYear)
If CurrentDay => 10 and MyMonth < 10 then varDateNow =
Trim(Currentday) & "/" & "0" & Trim(MyMonth) & "/" & Trim(MyYear)
If CurrentDay >= 10 and MyMonth >=10 then varDateNow =
Trim(Currentday) & "/" & Trim(MyMonth) & "/" & Trim(MyYear)
'If CurrentDay < 10 then CurrentDay = "0" & CurrentDay
varDateNow = CDATE(VarDateNow)


'''''''''''''''''''­''''''''''''''''''''­''''''''''''''''''''­''''''''''''''''''''­''''''''''''''''''''­''''''''
'response.write "varDateNow = " & varDateNow & "<br>"
'''''''''''''''''''­''''''''''''''''''''­''''''''''''''''''''­''''''''''''''''''''­''''''''''''''''''''­''''''''
set rsCal = cnndata.Execute("SE­LECT codate, cidate FROM tblReservation
WHERE cidate >= '" & varDateNow & "' AND room ='ICT-01'")
If Not rsCal.EOF then RoomCI = rscal("cidate")
If Not rsCal.EOF then RoomCO = rscal("codate")
RoomCI = CDATE(RoomCI)
RoomCO = CDATE(RoomCO)
varDateNow = CDATE(varDateNow)

If RoomCO = varDateNow AND RoomCI < varDateNow THEN varBackground =
"green"
If RoomCI = varDateNow then varBackground = "red"

If Not rsCal.EOF then RoomCI = rscal("cidate")

RoomCI = CDATE(RoomCI)
RoomCO = CDATE(RoomCO)

If Not rsCal.EOF then rsCal.MoveNext

'''''''''''''''''''­''''''''''''''''''''­''''''''''''''''''''­''''''''''''''''''''­''''''''''''''''''''­''''''''







'==================­====================­==========

response.write "<td bgcolor='" & varBackground & "'"

if MyMonth = Month(Date) and CurrentDay = Day(Date) then
response.write " align='center'>"
else
response.write " align='center'>"
end if


'Print the day date number and bold on selected date

if request("selectedda­te") = "" Then
if CurrentDay = day(date) Then
response.write "" & CurrentDay & ""
else
response.write "<font=Arial>" & CurrentDay & "</font>" 'This is
the line that writes the days to the calendar
end if
else
if day(request("select­eddate")) = CurrentDay Then
response.write "" & "<font=Arial>" & CurrentDay & "</font>" & ""
else
response.write CurrentDay
end if

end if

response.write "</a></td>"

CurrentDay = CurrentDay + 1

End If

Next
response.write "</tr>"
Next


response.write "</table>"



'------ Sub and functions


Sub ShowHeader(MyMonth,­MyYear)
%>
<body>


<table cellspacing='1' cellpadding='0' width='35%' border="1"
bordercolor="#80000­0">
<tr align='center'>
<td colspan='7'>
<table border='0' width='100%'>
<tr>
<td align='left'>

<font face="Tahoma" color="black">

<%
response.write "<font face='Tahoma' color='black'><a href = '" &
Request.ServerVaria­bles("SCRIPT_NAME") & "?"
if MyMonth - 1 = 0 then
response.write "month=12&year=" & MyYear -1
else
response.write "month=" & MyMonth - 1 & "&year=" & MyYear
end if
response.write "'><<</a>"
%>

</font>

</td><td align='center' class='ListHeaderTa­ble'>

<%
response.write "<b><font face='Tahoma' color='black'>" &
MonthName(MyMonth) & " " & MyYear & "</font></b>"
%>

</font>

</td><td align='right'>


<%
response.write "<font face='Tahoma' color='black'><a href = '" &
Request.ServerVaria­bles("SCRIPT_NAME") & "?"
if MyMonth + 1 = 13 then
response.write "month=1&year=" & MyYear + 1
else
response.write "month=" & MyMonth + 1 & "&year=" & MyYear

end if
response.write "'>>></a>"
%>

</font>

</td></tr></table>
</td>
</tr>
<tr align='center'>
<td width="8%" ><font color="#800000" face="Tahoma"><b><i­>Sun</i></
</font></td>
<td width="8%" ><font color="#800000" face="Tahoma"><b><i­>Mon</i></
</font></td>
<td width="8%" ><font color="#800000" face="Tahoma"><b><i­>Tue</i></
</font></td>
<td width="8%" ><font color="#800000" face="Tahoma"><b><i­>Wed</i></
</font></td>
<td width="8%" ><font color="#800000" face="Tahoma"><b><i­>Thu</i></
</font></td>
<td width="8%" ><font color="#800000" face="Tahoma"><b><i­>Fri</i></
</font></td>
<td width="8%" ><font color="#800000" face="Tahoma"><b><i­>Sat</i></
</font></td>
</tr>


</body>

<%
End Sub

Function MonthName(MyMonth)
Select Case MyMonth
Case 1
MonthName = "January"
Case 2
MonthName = "Febuary"
Case 3
MonthName = "March"
Case 4
MonthName = "April"
Case 5
MonthName = "May"
Case 6
MonthName = "June"
Case 7
MonthName = "July"
Case 8
MonthName = "August"
Case 9
MonthName = "September"
Case 10
MonthName = "October"
Case 11
MonthName = "November"
Case 12
MonthName = "December"
Case Else
MonthName = "ERROR! - Monthname"
End Select
End Function

Function LastDay(MyMonth, MyYear)
' Returns the last day of the month. Takes into account leap years
' Usage: LastDay(Month, Year)
' Example: LastDay(12,2000) or LastDay(12) or Lastday


Select Case MyMonth
Case 1, 3, 5, 7, 8, 10, 12
LastDay = 31

Case 4, 6, 9, 11
LastDay = 30

Case 2
If IsDate(MyYear & "-" & MyMonth & "-" & "29") Then
LastDay = 29 Else LastDay = 28

Case Else
LastDay = 0

End Select
End Function
%>
comment 5 answers | Add comment

Add new topic:

How:  Register )
 
Логин:   Пароль:   
Комментировать могут: Премодерация:
Topic:
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


QAIX > ASP web-programmingGo to page: « previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | next »

see also:
$PHP_AUTH_USER, $PHP_AUTH_PW and…
[ANNOUNCE] New template class
search engine for dynamic site
пройди тесты:
see also:
My brother thought me this prayer
The song my brother thought me
can some1 please help me in...

  Copyright © 2001—2008 QAIX
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.qaix.com.
Сообщения об ошибках оставляем в сообществе bugs.qaix.com.
Предложения и комментарии пишем в сообществе suggest.qaix.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .