How to avoid pre-moderation of my comments?
ASP web-programming
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What is interesting here?
• Duels
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Register!

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

  Top users: 
  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Модератор:
Friday, 29 August 2008
Uploading pictures to server Ellie 22:19:19
 I have an ASP 3.0 website and I would like to have certain logged in
visitors able to upload pictures and have them saved to a specific
directory. I am very, very new to this so I would appreciate a pointer as to
where I can find out how to do this. Thanks. Ellie

comment 2 answer | Add comment
Thursday, 28 August 2008
Thread Drop Issue A . Robinson 23:49:43
 We are seeing an error in our SQL Server logs I'm not very familiar with, and
was hoping someone on her ecould shed some light on the subject...

I installed the SS DBA Dashboard on one of our boxes. This box is a 64 bit
Windows Server 2003, SP2 running SQL Server 2005 64 bit, Service PAck 2 with
Cumulative Update 3 applied. The entire box has 16GB or RAM and 16
processors. We have 12GB of RAM devoted exclusively to SQL Server, which is
allocated on start up.

Here is the error we're getting:

08/26/2008 04:55:04,spid147,Un­known,AppDomain 62
(SS_DBA_Dashboard.d­bo[runtime].61) created.
08/26/2008 04:54:59,spid1s,Unk­nown,AppDomain 61
(SS_DBA_Dashboard.d­bo[runtime].60) unloaded.
08/26/2008 04:54:59,spid1s,Unk­nown,AppDomain 61
(SS_DBA_Dashboard.d­bo[runtime].60) is marked for unload due to memory
pressure.
08/26/2008 04:49:06,spid91,Unk­nown,AppDomain 61
(SS_DBA_Dashboard.d­bo[runtime].60) created.
08/26/2008 04:48:17,spid1s,Unk­nown,AppDomain 60
(SS_DBA_Dashboard.d­bo[runtime].59) unloaded.
08/26/2008 04:48:17,spid1s,Unk­nown,AppDomain 60
(SS_DBA_Dashboard.d­bo[runtime].59) is marked for unload due to memory
pressure.

These AppDomains appear to be under some kind of pressure, then get
unloaded, then a new one gets created. There is a stored procedure that runs
every minute...

The DBA Dashboard consists of one .dll, two sptored procedures and a very
small database. The stored procedure gets run every minute and gather stats
on database activity. Here's a link to the application:

http://www.sqlserve­rexamples.com/v2/Pro­ducts/tabid/76/Defau­lt.aspx

I've been reading and keep coming across this issue, but have only seen it
in relation to shops running on 32 bit platofrms.

I have no idea what the scoop is here, but am assuming it's got something to
do with .Net somehow

Any insight would be appreciated!


comment 3 answer | Add comment
Visit Counter II Paul W Smith 21:27:19
 The code below works as a page counter for me, counting how many visits my
web site has per week (Sunday - Saturday). This works fine - it write the
date and the count to a text file e.g.

15/8/2008
1001

When the new week arrives the old information is just overwritten, however
what I would like to do is keep the old information but starting the new
week with two new lines appended to the top of the existing information so
maintaining the historical data.

or

I actually can write the code that appends the two new lines when the new
week starts. However I do not have sufficient knowledge to be able to write
the ASP required to either amend the top two lines of the textstream (for
when the total should be added).

Any help or references gratefully received.

PWS

~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~


strCountFileName = Server.MapPath(Requ­est.ServerVariables(­"SCRIPT_NAME") &
".cnt")

Set objFSO = Server.CreateObject­("Scripting.FileSyst­emObject")

Set objCountFile = objFSO.OpenTextFile­(strCountFileName, 1, True)

If Not objCountFile.AtEndO­fStream Then
dtDate = CDate(objCountFile.­ReadLine)
iCount = CLng(objCountFile.R­eadLine)
Else
dtDate = Date
iCount = 0
End If

objCountFile.Close
Set objCountFile = Nothing

If IsEmpty(Session("To­talCount")) Then

If Weekday(Date(),vbSu­nday) = 1 And dtDate <> Date then
iCount = 1
Else
iCount = iCount + 1
End If
dtDate = Date

End If

Session("TotalCount­")= iCount

Set objCountFile = objFSO.CreateTextFi­le(strCountFileName,­ True)

objCountFile.WriteL­ine dtDate

objCountFile.WriteL­ine iCount

objCountFile.Close
Set objCountFile = Nothing

Set objFSO = Nothing

Response.Write iCount


Add comment
HttpHelper not called Polaris T 14:33:01
 I’m trying to get a httphanlder to add a jpg to a aspx page but iis 6 is
refusing to call the handler. The code runs ok when I run it from the VS 2005
development environment but fails when deployed. The page loads but I just
see a place holder for the image with a little red cross in the corner.

I’ve added the httphandler to the web.config file and this looks ok.

I also think iis is finding the assembaly ok. (If I change the name of the
class or name space in web.config I get an error when I try to load the page)

<httpHandlers>

<add verb="*" path="*.jpg" type="Info.JpgHandl­er" />

</httpHandlers>

I’ve added .jpg to the ScriptMaps tag in the metabase.xml file for the
server. This looks ok as the addition can be viewed and changed in the iis
management console for the correct virtual directory and the changes are
reflected in the metabase file. I’ve also unchecked ‘Verify file exists’ and
checked ‘Script engine’.

Can anyone suggest a way forward?

Add comment
Wednesday, 27 August 2008
Re: Sporadic errors Old Pedant 14:02:14
 
"MikeR" wrote:

DSQL = "DELETE * FROM Worked " _
& " WHERE CALL = '" & SanCall & "' " _
& " AND ADIF NOT IN (" & cbs & ")"
and ADIF was a text field. I changed it to a number.

Well, it's clearly better to make it a number, but it *could* have worked as
a text field with a minor change:

cbs = resafe.Replace( cbs, "" )
cbs = "'" & Replace( cbs, ",", "','" )
DSQL = "DELETE * FROM Worked " _
& " WHERE CALL = '" & SanCall & "' " _
& " AND ADIF NOT IN (" & cbs & ")"

You see that? But then the resafe regexp would need to be changed, also, to
allow textual data instead of all numeric data.




comment 6 answers | Add comment
Tuesday, 26 August 2008
XML document must have a top level element C676228 05:16:00
 Hi all,

I had a program and it always works fine and suddenly it gives me the
following message when a pass a xml file to our server program:
error code: -1072896680 reason: XML document must have a top level element.
line #: 0
I don't know if it is my xml file or it is something else?

Here is my client side program:
<%@ Language=vbScript%>­
<%
Set xmlDom=CreateObject­("Microsoft.XMLDOM")­

XMLDom.async =False
xmlDom.load Server.MapPath("052­72008ACTest.xml")
DataToSend = xmlDom.xml

dim xmlhttp
set xmlhttp = server.Createobject­("MSXML2.ServerXMLHT­TP")

xmlhttp.Open "POST","https://www­.mydomain.com/ac/xt_­ac_B2B.asp",false

xmlhttp.setRequestH­eader "Content-Type", "application/x-www-­form-urlencoded"

xmlhttp.send DataToSend
if(Err <> 0) then
Response.Write("An error occured when retrieving data from an external
source.<br />")
Response.Write(Err.­Description)
Response.End
end if
On error goto 0
'if request is not Ok then display detailed message about the request
problem
if(xmlHttp.status <> 200) then
Response.Write("The­ remote server returned an invalid statuscode: #8221;"
& _
xmlHttp.status & " " & xmlHttp.statusText)­ & "<br>"
Response.Write("res­ponse text from remote server" & _
" " & xmlHttp.responseTex­t)
Response.End
end if

if xmlHttp.responseXML­ is nothing then
Response.Write("The­ remote server didn’t return xml content.")
Response.End
end if
Response.ContentTyp­e = "text/xml"
Response.Write xmlhttp.responsexml­.xml
Set xmlhttp = nothing
%>

and 05272008ACTest.xml file is like this:
- <enrollment orderID="2008082511­14527143" PONumber="50000"
marketingCode="E" productName="advent­ureCenter">
<test>Y</test>
<residency>US</resi­dency>
- <coverageOption>
<partI totalPartIPayment="­12.55">Y</partI>
<partII totalPartIPayment="­">N</partII>
</coverageOption>
<tripName>European Tour</tripName>
<enrollmentFee>5.00­</enrollmentFee>
<totalPayment>765.0­0</totalPayment>
<tripDates departureDate="5/14­/2007" returnDate="5/17/20­07" tripDays="4" />
<numofParticipant>3­</numofParticipant>
- <participants>
<participant firstName="Cindy" mInit="b" lastName="Rose"
birthdate="4/26/195­5" tripCost="2500" partIPremium="187.5­0"
partIIPremium="25.0­0" />
<participant firstName="Kathy" mInit="c" lastName="Barlow"
birthdate="6/28/194­4" tripCost="2500" partIPremium="262.5­0"
partIIPremium="35.0­0" />
<participant firstName="Matthrew­" mInit="d" lastName="Kaminski"­
birthdate="4/27/193­3" tripCost="2500" partIPremium="300.0­0"
partIIPremium="45.0­0" />
</participants>
<mailingInfo name="Betty Sun" address="4406 Larwin ct." city="Concord"
state="CA" province="" zip="12345" country="United States" />
<email>sunshine@yah­oo.com</email>
- <phone>
<homePhone number="4057887933"­>Y</homePhone>
<bizPhone>N</bizPho­ne>
</phone>
<enrollAgreement>Y<­/enrollAgreement>
- <payment>
<method>card</metho­d>
<billingAddress name="Betty Sun" street="4406 larwin ct." city="Concord"
state="CA" province="" country="United States" />
<creditCard type="visa" number="4XXXXXXXXXX­XXXX" expDate="7/2007" />
</payment>
</enrollment>

and My server program is like this:

Dim xmlDoc, InstreamXMLRoot, TestFlag

Set xmlDoc=Server.Creat­eObject("Microsoft.X­MLDOM")
xmlDoc.Load Request '--this is for xml sent via body

Response.ContentTyp­e = "text/xml" '--for testing program

'******************­*****************
'the server program complains here, but the funny thing
is I save the stream on the server and the file looks the same
as it is passed and it displays in the browser very well, I don't get it!!!!!
'******************­*****************
If xmlDoc.parseError.e­rrorCode <> 0 Then
Call UpdateXMLResponse(o­rderID, "False", "XML", "error code: "
&xmlDoc.parseError.­errorCode & " reason: " &xmlDoc.parseError.­reason &" line
#: " &xmlDoc.parseError.­line , "")
End If

IF isNULL(xmlDoc) Then
Set InstreamXMLRoot=Not­hing
Call UpdateXMLResponse(o­rderID, "False", "XML", "The server didn't receive
the XML stream", "")

END IF

Set InstreamXMLRoot=xml­Doc.documentElement
IF isNULL(InstreamXMLR­oot) Then
Set InstreamXMLRoot=Not­hing
Call UpdateXMLResponse(o­rderID, "False", "XML", "The server didn't receive
the XML stream", "")

END IF
'Save all info before any transaction
xmlDoc.Save(Server.­MapPath("B2BResponse­/" & hour(now) & "_" & minute(now) &
"_" & RandomNumber(100000­0) & "_" & month(now) & "_" & day(now) & "_" &
year(now) &"_B2BResponse.xml"­))

--
Betty
comment 5 answers | Add comment
Monday, 25 August 2008
Working with an array Steve 23:26:14
 Not certain this is the correct newsgroup to post this, but I hope someone
here can help me. I am creating an array from a form field, parsing it, then
posting the data to a database using classic ASP. The problem I am
encountering is that the data is doubling up when posting. For example, if
there is only one item in the array, it will post twice. Below is the code I
am using: If anyone could be of any assistance, I sure would appreciate
it....

if Request.Form.Count > 0 then
if request.form("FormC­ouponCode") <> "" then
formCpnCode = trim(request.form("­FormCouponCode"))
for i = 0 to 32
formCpnCode = replace(formCpnCode­,chr(i),"")
next
codeArray = split(formCpnCode,"­,")
codeArrayCount = uBound(codeArray)

for i = 0 to codeArrayCount
item = codeArray(i)
sql = "SELECT bucksID, bcksNo, bcksOrderID, bcksValue,
bcksActive, bcksCpType FROM bobBucks WHERE bcksNo='" & item & "' and
(bcksActive='yes' or bcksActive='Yes')"
Set rst = Server.CreateObject­("ADODB.RecordSet")
rst.Open sql, cnn
if rst.eof then
isCouponGood="no"
bckValue=0
else
isCouponGood=rst("b­cksActive")
bckValue=rst("bcksV­alue")
end if
dim rSql,rst1
Set rst1 = Server.CreateObject­("ADODB.RecordSet")
rSql = "Select * FROM sfTmpOrdersAE"
rst1.Open rSql, cnn, adOpenStatic, adLockOptimistic
rst1.AddNew
rst1("odrtmpSession­Id") = Session("SessionID"­)
rst1("odrtmpCouponC­ode") = item
rst1("odrtmpIsActiv­e") = isCouponGood
rst1("odrtmpValue")­ = bckValue
rst1.update

next
end if
end if

Steve


comment 5 answers | Add comment
Problem with Stored Procedure Phil Grimpo 22:50:37
 I have this in my stored procedure:

@PageID INT,
@VersionID INT

UPDATE Pages SET MainData = (SELECT MainData FROM Pages_Archive WHERE
PageID = @PageID AND VersionID = @VersionID)
WHERE PageID = @PageID



I get this error: "Error 279: The text, ntext, and image data types are
invalid in this subquery or aggregate expression."

MainData is of type "text"

However, I have done this same things before in an INSERT statement.
Does it not work for UPDATE?

Thanks.

-Phil

Add comment
Can't debug? Bob Altman 18:04:06
 Hi all,

I'm a very experienced VB.Net developer just starting to climb up the
ASP.Net learning curve. I followed a couple of the beginning "how to"
tutorials included with the MSDN docs, but I've run into a problem that I
can't figure out. When I run my simple ASP.Net web app under the debugger,
it doesn't stop at any breakpoints.

Here are the details: I'm using VS 2005 Team Suite SP1. I created the
solution by selecting "Create: Website" from the start page and selecting
the "ASP.Net Web Site" template. The first time I tried running under
debug, I got a polite message telling me that I needed to uncheck the
"Disable script debugging" setting in Internet Properties, which I did.
That made the message go away, but that didn't help. I've checked my
web.config file and it contains

<compilation debug="true" strict="true" explicit="true"/>

When I press F5, Visual Studio looks like its starting to run under debug,
but then my web page is displayed and breakpoints are simply ignored. (The
red ball next to the breakpoint is filled in, indicating that the debugger
is happy with that line. And I know it has to be executing that line
because I see the result on my web page.) Another strange behavior is that
the part of the VS text editor that was occluded by my web page when it was
displayed is not redrawn correctly, leading me to suspect that VS is somehow
unnaturally unhappy with something I'm doing.

Any suggestions?

TIA - Bob

comment 6 answers | Add comment
Upgrading to ASP.Net Dave1031 01:08:21
 I know I am quite behind the times but I need to finally upgrade our website
from classic ASP 3.0 to ASP.Net.

I plan on creating apsx pages with the same names as the old asp pages.
Then remove all of the code from the old asp page with the exception of a
Response.redirect to the comparably named apsx page.

Is this pretty much standard practice when upgrading?

Any insights from someone who has done this?
comment 2 answer | Add comment
Sunday, 24 August 2008
Increase Width of GridView Column Dmbuso 16:44:02
 How do I increase the default width of a gridview column (just one column,
the 10th column, named "Notes")?

In design mode, I changed the width properties of the HeaderStyle,
ControlStyle, and ItemStyle to 300 px and set Wrap to False for the
HeaderStyle and ItemStyle. When I accept settings the "Notes" field widens in
design mode but when I run the web site, the Notes field is back to default
width.

PS - My gridview is bound to SqlDataSource1 which is a SELECT statement to a
SQL Server 2005 database table.

--
Dave B.
comment 2 answer | Add comment
Saturday, 23 August 2008
problem with javascript in asp not rounding up.. Gtn170777 16:58:50
 Hi All,

I have a neat little script that calculates price based on quantity without
refreshing the page.. the script is -

<script type="text/javascri­pt">
function OpenWin(url)
{
window.open(url,'wi­n','scrollbars=1,sta­tus=0,resizable=0,wi­dth=200,height=265')­;
}


function btnCalculate_onclic­k()
{
var numQty;
var adprice;

if (isNaN(document.frm­Client.txtQty.value)­)
{
alert('Please enter a number for advert quantity.');
}
else
{
numQty = parseInt(document.f­rmClient.txtQty.valu­e);
adprice = parseInt(document.f­rmClient.adprice.val­ue);

if((numQty >= 1) && (numQty <= 1)){
document.getElement­ById('divPrice').inn­erHTML = ' ' + adprice + ' + VAT';
document.getElement­ById('maindivPrice')­.innerHTML = ' ' +
Math.round(100*(adp­rice * numQty))/100 + ' + VAT';
} else if((numQty >= 2) && (numQty <= 10)){
document.getElement­ById('divPrice').inn­erHTML = ' ' +
(Math.round(adprice­ * numQty)*.95)/numQty­ + ' + VAT';
document.getElement­ById('maindivPrice')­.innerHTML = ' ' +
Math.round(adprice * numQty)*.95 + ' + VAT';
} else if((numQty >= 11) && (numQty <= 20)){
document.getElement­ById('divPrice').inn­erHTML = ' ' +
(Math.round(adprice­ * numQty)*.85)/numQty­ + ' + VAT';
document.getElement­ById('maindivPrice')­.innerHTML = ' ' +
Math.round(adprice * numQty)*.85 + ' + VAT';
} else if((numQty >= 21) && (numQty <= 30)){
document.getElement­ById('divPrice').inn­erHTML = ' ' +
(Math.round(adprice­ * numQty)*.75)/numQty­ + ' + VAT';
document.getElement­ById('maindivPrice')­.innerHTML = ' ' +
Math.round(adprice * numQty)*.75 + ' + VAT';
} else if((numQty >= 31) && (numQty <= 50)){
document.getElement­ById('divPrice').inn­erHTML = ' ' +
(Math.round(adprice­ * numQty)*.5)/numQty + ' + VAT';
document.getElement­ById('maindivPrice')­.innerHTML = ' ' +
Math.round(adprice * numQty)*.5 + ' + VAT';
} else {
alert("Please contact us for more information about the benefits of our
monthly account packages.");
}
}
}</script>

The problem I have is that it doesn't round up, for instance in stead of
0.95 i get 0.9499999999998.

Does anyone have any ideas how to fix this?

Many thanks
comment 15 answers | Add comment
Friday, 22 August 2008
Output to Excel 2007 Displayname 19:39:01
 The following code used to outputs to Excel 2003 fine. Do I need to change it
to output to Excel 2007?
<%
Response.ContentTyp­e = "application/vnd.ms­-excel"
Response.AddHeader "Content-Dispositio­n", "attachment; filename=List.xls"
%>

In addition, it pops a small File Download - Security Warning window showing
the Name: List.xls
Type: MS Excel 97-2003 Worksheet, 2.66 MB
and it displays the output in Excel fine.

But other times it it pops a small File Download - Security Warning window
showing the
Name: MyAspPage_asp (instead of List.xls)
Type: MS Excel 97-2003 Worksheet, 416 bytes
and when I click on Save it shows error:
IE cannot download MyAspPage.asp
and if I click Open instead of Save it will pop up a small Microsoft Office
Excel window with the following error:
"Microsoft Excel cannot access the file
'https://www.myurl.­com/dir1/MyAspPage.a­sp'. There are several possible
reasons:
- The file name or path name does not exist.
- The file you're trying to open is being used by another program. Close
the document in the other program, and try again.
- The name of the workbook you're trying to save is the same as the name
of another document that is read-only. Try saving the workbook with a
different name."

Add comment
how to retrieve CheckBox value using GET Method ? Magix 19:29:30
 If I have

<form action="process.asp­" method="get" name="form1">

...
...
<input TYPE=checkbox name=sports VALUE=Cricket>
<input TYPE=checkbox name=sports VALUE=Swimming>
<input TYPE=checkbox name=sports VALUE=Football>

</form>

If I check all, when submit, I will get in URL string

http://....?... &sports=Cricket&spo­rts=Swimming&sports=­Football

So, in process.asp, how can I differentiate each of them with
request.querystring­("sports)?
How cna I know how many "sports" have been selected ?
Assume that all must having same checkbox name, and must use GET method,
instead of POST

Thanks.

regards,
Magix


comment 9 answers | Add comment
Re: Payment Gateway in asp Dave Anderson 16:47:09
 <vinodkus@gmail.com>­ wrote:
Please tell me how to do payment gateway in asp .
please provide me coding or refer me any site so that I can
understood it easily. I have to do it with ICICI bank. I have
been provided a link for it but i dont know how to implent it.

There are a small list of payment gateways here:
http://en.wikipedia­.org/wiki/Payment_ga­teway

Each ought to be able to provide you samples for working with their
products.



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.

Add comment
Internacionalization Paulo 15:45:16
 What is the best approach? Using DB wich stores the translation of the
variable used on site for each language?

LANGUAGE_CODE, VARIABLE, TRANSLATION
1,'CustomerWord','C­ustomer'
2,'CustomerWord','C­liente' -> 'BR Portuguese

Thanks


comment 3 answer | Add comment
CDO.dll or cdosys.dll Jerry C 05:19:26
 I am working on a program that gets mail messages from the default SMTP
server with iis 6.0 on windows server 2003. I am using the cdosys.dll in the
system32 directory. The reference Name is "Microsoft CDO for Windows 2000
Library".

On the machine there is a CDO.dll in the Program Files\Common
Files\System\MSMAPI­\1033 directory.

The question is which one of these is the current dll. I also wonder if
there is better way to access mail messages in the SMTP server. Does the
dotnet framework have a object for this like system.net.mail that does this.

I am using the objects:
Dim objDropDir As New CDO.DropDirectory
Dim objMessages As CDO.IMessages
Dim objMailMessage As CDO.IMessage
Dim MailAttachments As CDO.IBodyParts
Dim MailAttachment As CDO.IBodyPart

to get messages in the drop directory (.eml files) open them and get any
attached file.

Thank you


--
Jerry
comment 2 answer | Add comment
Thursday, 21 August 2008
RE: Please Help Advanse Search, two parts are working, the 3rd to conn Old Pedant 22:45:09
 
First, change your options for the salary to this:

<select name="Salarycom" size="1">
<option selected value="">All</optio­n>
<option value="BETWEEN 0 AND 10000">10000</optio­n>
<option value="BETWEEN 10001 AND 20000">20000</optio­n>
<option value="BETWEEN 20001 AND 30000">30000</optio­n>
<option value="BETWEEN 30001 AND 40000">30000</optio­n>
<option value="BETWEEN 40001 AND 50000">50000</optio­n>
<option value="BETWEEN 50001 AND 60000">60000</optio­n>
<option value="BETWEEN 60001 AND 70000">70000</optio­n>
<option value="BETWEEN 70001 AND 80000">80000</optio­n>
<option value="BETWEEN 80001 AND 90000">90000</optio­n>
<option value="> 100000 or Abv">100000 or Abv</option>
</select>



<%@ LANGUAGE="VBSCRIPT"­ %>
<html>
<head>
<title>Search Engine Results!</title>
</head>

<body>
<%

Dim SQL

Set aspdbweb = Server.CreateObject­("ADODB.Connection")­
aspdbweb = "Provider=Microsoft­.Jet.OLEDB.4.0; " _
& Data Source=" & Server.MapPath("emp­loyees.mdb") & ";"

' WHERE 1=1 is sneaky trick so we can use AND for other conditions
SQL = "SELECT * FROM Employees WHERE 1=1 "

' the REPLACE calls are to protect against SQL injection
whatToSearch = Replace( Trim( Request("ASPDBCatSe­arch") ), "'", "''" )
keyword = Replace( Trim( Request("Keyword") ), "'", "''" )

If whatToSearch <> "All" Then
SQL = SQL & " AND " & whatToSearch & " LIKE '%" & keyword & "%' "
End If

salary = Replace( Trim( Request("SalaryCom"­) ), "'", "''" )
If salary <> "" Then
SQL = SQL & " AND salary " & salary
End If

SQL = SQL & " ORDER BY LastName, FirstName " ' or whatever order you want

' don't use a static cursor when you don't need it...simpler & faster:
Set rsglobal = aspdbweb.Execute( SQL )
If rsglobal.EOF Then
%>
<h2 align="center">We did not find a match!</h2>
<%
Else
%>
<h2>Here are the results of your search:</h2>

... rest same ...

*******************­**

*NEVER* bother checking BOF. Pointless.

You can change the VALUE='s for salary to match what you mean if I didn't
guess right.

comment 1 answer | Add comment
Please Help Advanse Search, two parts are working, the 3rd to connect. Iahamed 16:27:18
 Hi Everyone,

I got two parts of my advance search to work, I am running out of Logic to
connect the third. My mind is in swing! Pleaseeeeeeeee Help me.

I have 3 Fiels to search, the First two works, thats:

1. Category to search from the (Drop down name: ASPDBCatSearch) is working
with the Input Text Box Field (name: keyword), based on Whatever selection on
the Drop down value selection:
The "Option Value" FirstName,Title,Ema­il etc... is connected to the Input
Text Box Field (name: keyword) with the asp code thus:

' HTML Drop down Name | FirstName is the value name

If Request.Form("ASPDB­CatSearch") = "FirstName" Then

' HTML Input Text Box name is keyword

SQL = SQL & " WHERE FirstName LIKE '%" & Request.Form("keywo­rd") & "%'
"
End If

The rest values based on selection works with the Keyword typing.

My Question is: I have added another drop Down Call salary (name: Salarycom), I need to add that to the Search Logic, and I am lost, How can I do this please?

In Breiaf How can I connect the "Salary Drop down Values" to the Category
Search drop down + and the Input txt box Search to match the Exact Search?

Can Some one Give me two sentences of example with my above Added code as to
how the salary values should be added to the Category and Input txt box
fields in the asp code?

-------------------­--------------------­--------------------­-------------------


The html Code:


<table border="0" width="525" bgcolor="#FFFFFF" cellspacing="3"
cellpadding="3"
style="border: 0px outset #EEEEEE; ">
<tr>
<td width="515" bgcolor="#FFFFFF"><­form action="Searchengin­eresults.asp"
method="post" align="center">

<div align="center"><cen­ter>
<table border="1" width="486" cellpadding="3"
bgcolor="#F5F5F5" bordercolorlight="#­EEEEEE" style="border-colla­pse:
collapse">
<tr>
<td align="left" width="169"><strong­><font face="Tahoma"><big>­<big>
<font size="1">1.</font><­/big></big><font size="1"> Select a category to
search</font></font­></strong><p align="center"><sel­ect
name="ASPDBCatSearc­h" size="1">
<option selected value="All">All</op­tion>
<option value="FirstName">F­irst Name</option>
<option value="LastName">La­st Name </option>
<option value="Title">Title­ </option>
<option value="Division">De­pt/Div </option>
<option value="Phone">Phone­ </option>
<option value="Email">E-Mai­l </option>
</select></td>
<td align="left" width="106" bgcolor="#FF870F"><­strong><font
face="Tahoma"><big>­<big>
<font size="1">2.</font><­/big></big><font size="1">
Salary</font></font­></strong><p>
<select name="Salarycom" size="1">
<option selected value="Allsal">All<­/option>
<option value="10000">10000­</option>
<option value="20000">20000­</option>
<option value="30000">30000­</option>
<option value="40000">30000­</option>
<option value="50000">50000­</option>
<option value="60000">60000­</option>
<option value="70000">70000­</option>
<option value="80000">80000­</option>
<option value="90000">90000­</option>

<option value="100000 or Abv">100000 or Abv</option>

</select></td>
<td width="172" align="right">
<p align="center"><str­ong><font face="Tahoma"><big>­<big>
<font size="1">3.</font><­/big></big><font size="1"> Type search
criteria</font></fo­nt></strong><p>
<input type="text" size="30" name="keyword"></td­>
</tr>
<tr>
<td colspan="3" align="center" width="478">
<p><input type="reset" name="B2" value="Clear">
<input type="submit" name="B1" value="Search employees"></td>
</tr>
</table>
</center></div>
</form>
</td>
</tr>
</table>
</center></div>

</body>
</html>

-------------------­--------------------­--------------------­-------------------
-------------------­--

ASP Code Searchengineresults­.asp


<%@ LANGUAGE="VBSCRIPT"­ %>
<html>
<head>
<title>Search Engine Results!</title>
</head>

<body>
<%

Dim SQL

Set aspdbweb = Server.CreateObject­("ADODB.Connection")­
aspdbweb = "Provider=Microsoft­.Jet.OLEDB.4.0; Data Source=" & Server.MapPath
("employees.mdb") & ";"

SQL = "SELECT * FROM Employees"

' An Example on Salary Drop down Values to connect to the rest two (Category
and Input txt Box) please here will be appreciated


If Request.Form("ASPDB­CatSearch") = "FirstName" Then
SQL = SQL & " WHERE FirstName LIKE '%" & Request.Form("keywo­rd") & "%' "
End If

If Request.Form("ASPDB­CatSearch") = "LastName" Then
SQL = SQL & " WHERE LastName LIKE '%" & Request.Form("keywo­rd") & "%'"
End If

If Request.Form("ASPDB­CatSearch") = "Title" Then
SQL = SQL & " WHERE Title LIKE '%" & Request.Form("keywo­rd") & "%'"
End If

If Request.Form("ASPDB­CatSearch") = "Division" Then
SQL = SQL & " WHERE Division LIKE '%" & Request.Form("keywo­rd") & "%'"
End If

If Request.Form("ASPDB­CatSearch") = "Phone" Then
SQL = SQL & " WHERE Phone LIKE '%" & Request.Form("keywo­rd") & "%'"
End If

If Request.Form("ASPDB­CatSearch") = "Email" Then
SQL = SQL & " WHERE EMail LIKE '%" & Request.Form("keywo­rd") & "%'"
End If

Set rsglobal = Server.CreateObject­("ADODB.Recordset")
rsglobal.Open SQL, aspdbweb, 3
%>
<%
If rsglobal.BOF and rsglobal.EOF Then%>

<h2 align="center">We did not find a match!</h2>
<%Else%>


<%If Not rsglobal.BOF Then%>

<h2>Here are the results of your search:</h2>

<table BORDER="0" width="100%" cellpadding="3">
<tr>
<th bgcolor="#FF870F"><­span style="font-weight:­ 400">
<font face="Arial" color="#FFFFFF" size="1">First name </font></span></th>­
<th bgcolor="#FF870F"><­span style="font-weight:­ 400">
<font face="Arial" color="#FFFFFF" size="1">Last Name </font></span></th>­
<th bgcolor="#FF870F"><­span style="font-weight:­ 400">
<font face="Arial" color="#FFFFFF" size="1">Salary </font></span></th>­
<th bgcolor="#FF870F"><­span style="font-weight:­ 400">
<font face="Arial" color="#FFFFFF" size="1">Title </font></span></th>­
<th bgcolor="#FF870F"><­span style="font-weight:­ 400">
<font face="Arial" color="#FFFFFF" size="1">Division </font></span></th>­
<th bgcolor="#FF870F"><­span style="font-weight:­ 400">
<font face="Arial" color="#FFFFFF" size="1">Phone </font></span></th>­
<th bgcolor="#FF870F"><­span style="font-weight:­ 400">
<font face="Arial" color="#FFFFFF" size="1">E-Mail </font></span></th>­
</tr>
<%
Do While Not rsglobal.EOF
%>
<tr>
<td><%=rsglobal("Fi­rstName")%></td>
<td><%=rsglobal("La­stName")%></td>
<td><%=rsglobal("1S­alaryDB")%></td>
<td><%=rsglobal("Ti­tle")%></td>
<td><%=rsglobal("Di­vision")%></td>
<td><%=rsglobal("Ph­one")%></td>
<td><a href="mailto:<%=rsg­lobal("Email")%>"><%­=rsglobal("Email")%
</a></td>
</tr>
<% rsglobal.MoveNext
Loop
%>
</table>
<%End If%>
<%End If%>
<%
rsglobal.Close
%>
</body>
</html>

-------------------­--------------------­-----------------

Awaiting your favorable reply.

Thank you.
Add comment
Persits.upload problem .Net Sports 10:53:09
 I'm using Persits.upload module in ASP, and when i use the following
form pointed to the object I've always used, i get a "The system
cannot find the file specified" error pointing to the line of my
upload.savevirtual :

Set Upload = Server.CreateObject­("Persits.Upload")
upload.savevirtual ("test/")

.
''''error:
Persits.Upload.1 error '800a0005'

The system cannot find the file specified.

/upl/aspupload1.asp­, line 5


'''form
<form action="aspupload1.­asp" method="post" enctype="multipart/­form-
data">

<input type="file" size="40" name="FILE1" />

<br />
<input type="submit" value="Upload!" />
</form>


<form action="aspupload1.­asp" method="post" enctype="multipart/­form-
data">

<input type="file" size="40" name="FILE1" />

<br />
<input type="submit" value="Upload!" />
</form>


????????
comment 1 answer | Add comment
Create folder at remote site Tony WONG 10:26:56
 there is an asp page at IIS server for creating folder at remote site via
virtual folder

it is tested at Windows 2003 server.

the asp is ok if
http://localhost/te­st.asp

however it is not ok (error http 500) after the path of localhost is changed
to server name
http://servername/t­est.asp

i've opened all the security permission (file & iis), but still not ok.

tony


comment 2 answer | Add comment
Connect to Database Function Vunet 06:32:34
 Hello,
I want to create a useful function or sub whichever works great for
database connection to avoid typing same code all over. Earlier I was
using include file for opening and closing adoCon object and
connection. Now I really want to use a function to do it.
Can one recommend a good example?

I have this sample below which does not work for me because of the
mappath being wrong depending on what file under what directory calls
the file with this function:

Sub DB_CONN
Set adoCon = Server.CreateObject­("ADODB.Connection")­
adoCon.Open "Provider=Microsoft­.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("./d­b/web.mdb") & ";"
End Sub

Sub DB_CONN_CLOSE
Set adoCon = nothing
End Sub

Thank you for any advice.
comment 2 answer | Add comment
Wednesday, 20 August 2008
Re: Tweak to existing code-scanning folders for new files Bryan 19:12:30
 Anthony,
Thanks for the sample code... I'll try it out..
The code is used by another compiled program to download files from a web
server. Basically all files that are newer than the cutoff date are returned
in the xml, then another program downloads the files. I don't have any
control over the other program, so the xml has to look/function like the
existing xml to work.
Thanks again!
--
Thanks!
Bryan


"Anthony Jones" wrote:

"Bryan" <Bryan@discussions.­microsoft.com> wrote in message
news:8DBAF0A9-D4C7-­4C4A-B850-15AC5A6385­03@microsoft.com...
Hello group.
I have some code (given to me), but I don't know alot about ASP, so I was
hoping someone here can help. Running on Win 2008 server.
The code below will scan a folder and subfolder with a date/time input and
return xml structure off all files that are newer than the supplied
date/time.
The problem is that the returned xml has path names like
C:\folder\subfolder­\filename.ext
I would like it to be more like /folder/subfolder/f­ilename.ext
Also, the initial path gets returned in the xml "data", but I only want
the
sub folders below "data" to get scanned and info returned...
Any help would be greatly appreciated.
function indent(iTreeLevel)
dim rv : rv = ""
if iTreeLevel > 0 then
for i = 1 to iTreeLevel
rv = rv & " "
next
end if
indent = rv
end function
'==================­====================­====
function newItemsCount(objFo­lder, dCutoffDate)
dim rv : rv = 0
dim sFileModified
For Each objFile In objFolder.Files
sFileModified = objFile.DateLastMod­ified
If (sFileModified > dCutoffDate) Then
rv = rv + 1
End If
Next
newItemsCount = rv
end function
'==================­====================­====
function newItemsSize(objFol­der, dCutoffDate)
dim rv : rv = 0
dim sFileModified
For Each objFile In objFolder.Files
sFileModified = objFile.DateLastMod­ified
If (sFileModified > dCutoffDate) Then
rv = rv + objFile.Size
End If
Next
newItemsSize = rv
end function
'==================­====================­====
sub FolderListing(strPa­th, dCutoffDate, blnRecursive, iTreeLevel)
Dim objFolder
Set objFolder = objFSO.GetFolder(st­rPath)
response.write(inde­nt(iTreeLevel) & "<folder name=""" & objFolder.Name &
""" newitems=""" & newItemsCount(objFo­lder, dCutoffDate) & """
newitems_size=""" & newItemsSize(objFol­der, dCutoffDate) & """>" & vbCrLf)
For Each objFile In objFolder.Files
sFileSize = objFile.Size
sFileName = objFile.Name
sFileType = objFile.Type
sFileCreated = objFile.DateCreated­
sFileModified = objFile.DateLastMod­ified
If (sFileModified > dCutoffDate) Then
response.write(inde­nt(iTreeLevel) & " <file name=""" & sFileName & """
size=""" & sFileSize & """ date=""" & sFileModified & """ url=""" &
strPath &
"\" & sFileName & """/>" & vbCrLf)
End If
Next
If blnRecursive Then
Dim objSubFolders
Set objSubFolders = objFolder.SubFolder­s
For Each objFolder in objSubFolders
sFolderName = objFolder.Name
sFolderPath = strPath & "\" & sFolderName
FolderListing sFolderPath, dCutoffDate, blnRecursive, iTreeLevel+1
Next
End if
response.write(inde­nt(iTreeLevel) & "</folder>" & vbCrLf)
end sub
'==================­====================­====================­=================
==============
sDateTime = unescape(Request.Qu­eryString)
aDateTime = split(sDateTime, " ")
sDate = aDateTime(0)
sTime = aDateTime(1) & " " & aDateTime(2)
dDate = DateValue(sDate)
dTime = TimeValue(sTime)
dDateTime = dDate + dTime
Dim objFSO
Set objFSO = Server.CreateObject­("Scripting.FileSyst­emObject")
%>
<?xml version="1.0" encoding="utf-8"?>
<newfiles fromdate="<%= dDate %>" datestr="<%= sDate %>" timestr="<%=
sTime
%>" resultdatetime="<%=­ dDateTime %>">
<%
FolderListing server.MapPath("dat­a"), dDateTime, true, 0
%>
</newfiles>
Could not bring myself to tweak that code. Here is an alternative ASP:-
<%
Dim gfso : Set gfso = Server.CreateObject­("Scripting.FileSyst­emObject")
Dim gdatCutOff : gdatCutOff = FromISO8601(Request­.QueryString("cutoff­"))
Dim goXML : Set goXML = Server.CreateObject­("MSXML2.DOMDocument­.6.0")
goXML.LoadXML "<newItems />"
Dim gelemNewFiles : Set gelemNewFiles = goXML.documentEleme­nt
gelemNewFiles.setAt­tribute "from", ToISO8601(gdatCutOf­f)
Dim goDataFolder : Set goDataFolder = gfso.GetFolder(Serv­er.MapPath("data"))
GetFolderXML gelemNewFiles, goDataFolder, gdatCutOff
DropElems gelemNewFiles, "folder[@name='data']/file"
Response.ContentTyp­e = "text/xml"
Response.CharSet = "UTF-8"
goXML.Save Response
Sub GetFolderXML(relemP­arent, roFolder, rdatCutOff)
Dim oFolder
Dim oFile
Dim elemFolder
Dim elemFile
Set elemFolder = AddElem(relemParent­, "folder", Null)
elemFolder.setAttri­bute "name", roFolder.Name
For Each oFolder In roFolder.SubFolders­
GetFolderXML elemFolder, oFolder, rdatCutOff
Next
For Each oFile In roFolder.Files
If oFile.DateLastModif­ied > rdatCutOff Then
Set elemFile = AddElem(elemFolder,­ "file", Null)
elemFile.setAttribu­te "name", oFile.Name
elemFile.setAttribu­te "size", oFile.Size
elemFile.setAttribu­te "lastModified", ToISO8601(oFile.Dat­eLastModified)
End If
Next
End Sub
Sub DropElems(relem, rsXPath)
Dim oNode
Dim oList : Set oList = relem.SelectNodes(r­sXPath)
Dim lDummy : lDummy = oList.length 'Fill list
For Each oNode in oList
oNode.parentNode.re­moveChild oNode
Next
End Sub
Function FromISO8601(s)
' Returns date in local time if timezone not present or GMT if timezone is
present
FromISO8601 = DateSerial(Mid(s,1,­4), Mid(s,5,2), Mid(s,7,2))
If Len(s) > 8 Then
FromISO8601 = FromISO8601 + CDate(Mid(s,10,8))
End If
If Len(s) > 17 Then
FromISO8601 = FromISO8601 - CInt(Mid(s,18,1) & "1") * CDate(Mid(s,19,5))
End If
End Function
Function ToISO8601(rdat)
Dim sYMD : sYMD = CStr((Year(rdat)*10­0 + Month(rdat) )*100 + Day(rdat))
Dim sHMS : sHMS = Right((Hour(rdat)*1­00+Minute(rdat))*100­+Second(rdat)+1e7,
6)
ToISO8601 = sYMD & "T" & Left(sHMS, 2) & ":" & Mid(sHMS, 3,2) & ":" &
Right(sHMS, 2)
End Function
Function AddElem(roParent, rsName, rvntValue)
Set AddElem = roParent.ownerDocum­ent.createElement(rs­Name)
roParent.appendChil­d AddElem
If Not IsNull(rvntValue) Then AddElem.Text = rvntValue
End Function
%>
Its not a good idea to attempt to build XML output using response writes.
The code does not properly encode characters that have meaning in XML nor
was the character encoding correct. Had any files contained a & or a
character outside the base ASCII range the generated output would be
corrupt. My code uses DOM to build the XML, it makes the code much more
readable as well.
Note that my code uses ISO8601 formating for the date values all the
original code. Also it does not even attempt to place path info into the XML
nor does it include counts or size totals. All of these pieces of info can
be derived from the XML.
I have included your request to drop files found in the data folder itself
although I would have prefered that the data folder not have other files in
it. (Caveat, the folder name 'data' is case sensitive).
Call this page like this:-
/root/listnewfiles.­asp?cutoff=20080819T­21:30:00
What do you do with this XML once received?
--
Anthony Jones - MVP ASP/ASP.NET
comment 2 answer | Add comment

Add new topic:

How:  Register )
 
Login:   Password:   
Comments by: Premoderation:
Topic:
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или законы РФ. Ваш ip-адрес записывается.


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

see also:
PDF table height to fit one page only.
Image Extraction
JPedal Image Thumbnail Sample Code
pass tests:
Who you from Rozen Maiden-Traumend?
see also:
=)))
^___^
xD...

  Copyright © 2001—2010 QAIX
Идея: Монашёв Михаил.
Авторами текстов, изображений и видео, размещённых на этой странице, являются пользователи сайта.
See Help and FAQ in the community support.qaix.com.
Write in the community about the bugs you have noticedbugs.qaix.com.
Write your offers and comments in the communities suggest.qaix.com.
Information for parents.
Пишите нам на .
If you would like to report an abuse of our service, such as a spam message, please .
Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .