|
Hi i have a script im trying to get to work i need to split a date an re-join it back in a different order heres what i have so far, i can get it to split buti need to join it back into one again.
ages = request.querystring("age1")<br />
agesplit = Split(ages, ",")<br />
<br />
Dim agesplit(3)<br />
<br />
one = agesplit(0)<br />
two = agesplit(1)<br />
three = agesplit(2)<br />
<br />
Dim OneDimArray(3)<br />
<br />
OneDimArray(2) = one<br />
OneDimArray(0) = two<br />
OneDimArray(1) = three<br />
<br />
Dim strSentence<br />
strSentence = join(OneDimArray)
cheers
|
|
|
|
|
ages = request.querystring("age1")
agesplit = Split(ages, ",")
Dim agesplit(3)
one = agesplit(0)
two = agesplit(1)
three = agesplit(2)
Dim strSentence
strSentence = two & "/" & three & "/" & one
e.g., 31/12/2005 (dd/mm/yyyy) and u wanna to write it as
12/2005/31 (mm/yyyy/yy)
|
|
|
|
|
Don't dimension agesplit as an array. It's not an array, it's a variant that contains an array.
When you dimension an array in VBScript, you don't give the number of items, but the highest index to use. If you want an array with three items, the highest index will be two.
Dim ages, agesplit, strSentence<br />
Dim OneDimArray(2)<br />
<br />
ages = Request.QueryString("age1")<br />
agesplit = Split(ages, ",")<br />
<br />
one = agesplit(0)<br />
two = agesplit(1)<br />
three = agesplit(2)<br />
<br />
OneDimArray(2) = one<br />
OneDimArray(0) = two<br />
OneDimArray(1) = three<br />
<br />
strSentence = join(OneDimArray, ",")
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for the help so far well heres what im trying to do with not much luck, i hate betweens grrr
'Dimension variables<br />
Dim adoCon2 <br />
Dim rsUser2 <br />
Dim strSQL2 <br />
Dim lngRecordNo2 <br />
Dim access<br />
<br />
<br />
<br />
lngRecordNo2 = Request.QueryString("ID")<br />
<br />
<br />
<br />
times = request.querystring("age2")<br />
<br />
<br />
<br />
sDate2 = times<br />
myArray2 = Split(sDate2, "/")<br />
<br />
sNewDate2 = myArray2(1) & "/" & myArray2(0) & "/" & myArray2(2)<br />
<br />
<br />
Dim ages, agesplit, strSentence<br />
Dim OneDimArray(2)<br />
<br />
ages = Request.QueryString("age1")<br />
agesplit = Split(ages, "/")<br />
<br />
one = agesplit(0)<br />
two = agesplit(1)<br />
three = agesplit(2)<br />
<br />
OneDimArray(2) = one<br />
OneDimArray(0) = two<br />
OneDimArray(1) = three<br />
<br />
strSentence = join(OneDimArray, "/") <br />
<br />
'Create an ADO connection odject<br />
Set adoCon2 = Server.CreateObject("ADODB.Connection")<br />
<br />
'Set an active connection to the Connection object using a DSN-less connection<br />
adoCon2.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database.mdb")<br />
<br />
'Create an ADO recordset object<br />
Set rsUser2 = Server.CreateObject("ADODB.Recordset")<br />
<br />
'Initialise the strSQL variable with an SQL statement to query the database<br />
strSQL2 = "SELECT * FROM student WHERE dob BETWEEN #"&strSentence&"# AND #"&sNewDate2&"# Order By student_id ASC"<br />
<br />
<br />
'Open the recordset with the SQL query <br />
rsUser2.Open strSQL2, adoCon2 ...
|
|
|
|
|
When working with the database, I would suggest that you format the date according to ISO 8601, e.g. "yyyy-mm-dd". This format is totally unambigous (contrary to almost all other date formats), and the database should have no problems to dechiper it, regardles of what the date format might currently be on the server.
---
b { font-weight: normal; }
|
|
|
|
|
Ive cracked it thanks for the help
heres my final code snipet
<br />
Dim adoCon2 <br />
Dim rsUser2 <br />
Dim strSQL2 <br />
Dim lngRecordNo2 <br />
Dim access<br />
<br />
lngRecordNo2 = Request.QueryString("ID")<br />
<br />
times = request.querystring("age2")<br />
times2 = request.querystring("age1")<br />
<br />
sDate2 = times<br />
myArray2 = Split(sDate2, "/")<br />
<br />
sNewDate2 = myArray2(0) & "/" & myArray2(1) & "/" & myArray2(2)<br />
<br />
sDate = times2<br />
myArray = Split(sDate, "/")<br />
<br />
sNewDate = myArray(0) & "/" & myArray(1) & "/" & myArray(2)<br />
<br />
Set adoCon2 = Server.CreateObject("ADODB.Connection")<br />
<br />
adoCon2.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database.mdb")<br />
<br />
Set rsUser2 = Server.CreateObject("ADODB.Recordset")<br />
<br />
strSQL2 = "SELECT * FROM student WHERE dob BETWEEN #"&sNewDate&"# AND #"&sNewDate2&"# Order By student_id ASC"<br />
<br />
rsUser2.Open strSQL2, adoCon2<br />
<br />
|
|
|
|
|
Hi,
I'm a newbie trying to write a fairly simple web app in C# with two complex issues - I need to present a document dialog box to the user, let them select a (usually MS Word) document on their local drive(s) and store it in a SQL Server 2000 table/column. I'm wondering if someone has some sample code (preferably C#) and can tell me what type of column needs to be defined in SQL Server to hold the document.
I'll also need the reverse: pulling the document out (mostly Word documents) and displaying it in the browser window.
I'm basically trying to store and retrieve these Word documents from various users in SQL Server 2000.
Any help would REALLY be appreciated! Thank you very much in advance!
Mike L.
|
|
|
|
|
Hi Mike,
+ To display a dialog box which allows the user to select a document on the client machine and upload it to the server, you can use an input file element. You can find the article posted on CP as an example:
http://www.codeproject.com/aspnet/fileupload.asp[^]
+ To store the Word document in SQL, you can define a column of the image type.
+ To insert/retrieve the content of the word document, you can use the ADO.NET[^] to implement the functionality. In addition to the above example, you can check out tons of examples in MSDN[^], CP and the internet.
+ To display the word document in the browser, you can save the content to disk and simply use a link to point to the file. You can also write out the content to the output stream of the Reponse object. Again, the above fileupload article can give you an idea on the issue.
|
|
|
|
|
I've seen a lot of code that demos ISAPI extension apps that works for browser based applications. Now i hope some good people provide some examples and code on how to build the same thing (ISAPI dll) that especially works with non-browser based applications.
b2c
|
|
|
|
|
Balu,
You mean Windows apps right. ISAPI stands for Internet Server API. You can embed a Web Browser or make a call to ISAPI dll from your Windows app via C# WebRequest or a similar trick and read the response back just like web browser. Is'nt it?
Did this attend to your query?
Vasudevan Deepak Kumar
Personal Web: http://www.lavanyadeepak.tk/
I Blog At: http://deepak.blogdrive.com/
|
|
|
|
|
I am trying to pop up a window from a link on a web page using the following code:
<br />
[head]<br />
[script etc etc]<br />
function popup(url)<br />
{<br />
window.open(url,'title','300,300');<br />
}<br />
[/script]<br />
[/head]<br />
<br />
[body]<br />
[a href='javascript:popup('someurl.html')']blahblah[/a]<br />
[/body]<br />
[edit]
The colon between javascript and popup is not showing up on this page but it is in the code
[/edit]
I have only shown the reqd bits so please don't tell me I missed out parts of the page
Now this works fine except if I use it in an IFrame on IE. On FF etc it works just as I would expect.
Does anybody have a clue if this is a security feature of IE? Or what is wrong?
Thanks
|
|
|
|
|
The problem is that you use the same delimiter for html attributes and javascript strings. The browser thinks that the attribute ends where you think that the string starts. To the browser, it's only this that makes sense of your anchor tag:
[a href='javascript:popup(']blahblah[/a]
This will of course cause an error. If you had error messages enabled in your browser, you would get the error in a popup. Now it only shows up in the status bar.
Use quotes for html attributes and apostrophes for javascript strings:
[a href="javascript:popup('someurl.html');"]blahblah[/a]
---
b { font-weight: normal; }
|
|
|
|
|
Thanks but that was my fault. No the delimeters aren't the same. I just typed them this way in the example code I posted.
Sorry.
|
|
|
|
|
Well, you get assistance on the code you show. If you don't show the code you use, you can't get help with it. If you need to shorten the code, make sure that the example still shows the faulty behaviour that you need to fix.
---
b { font-weight: normal; }
|
|
|
|
|
Hey all, I had a really beginner question for you as I somewhat come ino more and more interesting things with web development.
Suppose I have a website where every page has the same look and feel (e.g. A header which has a picture and some text or something). Suppose that I place this template on all pages, but one day I decide to change this template. What is the best way to set up such a system where this would be easy? Also, what if I wished to change the css styles throughout the actual pages of content themselves (i.e. a global css change). Is there a way to do this?
Thanks so much!
Did I post well? Rate it! Did I post badly? Rate that too!
|
|
|
|
|
1. Have a header.asp (or whatever scripting language you are using) and a footer.asp that contain the (amazingly enough) page headers and footers. Include them on every page. Siteside changes are a matter of changing one file.
2. Have a stylesheet.css (name it whatever you want) and reference it in every page html header (the [head] [/head] area NOT the page header from 1. above).
|
|
|
|
|
Hello,
Has anyone seen any examples of a simple form & JavaScript that lets the user set the refresh time for example:
- 10s
- 20s
- 30s
Then have the option to disable the auto fresh?
Thanks for the help.
JD
|
|
|
|
|
JD
Simple. JavaScript Timer depends on window.setTimeout taking time in msec and a function to evaluate.
You may like to have a function to call this window.setTimeout. But be aware, you need to store the return reference somewhere in a global JavaScript array if you want to call clearTimeout
Vasudevan Deepak Kumar
Personal Web: http://www.lavanyadeepak.tk/
I Blog At: http://deepak.blogdrive.com/
|
|
|
|
|
ALL MY pages works like a dream testing and running on my local machine running IIS. NOW I uploaded it to an APACHE server and this is the problem I am getting. NONE of my ASP pages works. Not even the simple little one to just display the date (They say ASP on the server is fine and it is problems on my files??? ) PLEASE THIS IS LIKE EXTREMELY URGENT if any one could help ???
ATTACHED is my error log. Was developed in Dreamweaver with Access DB and IIS server and tested and ran fine on it. ANY HELP???
[Fri Aug 12 08:29:45 2005] [error] [asp] [29216] [debug] \t(Missing
operator before end?) <-->
[Fri Aug 12 08:29:45 2005] [error] [asp] [29216] [debug] Bareword found
where operator expected at
/home/httpd/vhosts/comptraders.co.za/httpdocs/pricelist.asp line 170,
near """ AND" <-->
[Fri Aug 12 08:29:45 2005] [error] [asp] [29216] [debug] \t(Missing
operator before AND?) <-->
[Fri Aug 12 08:29:45 2005] [error] [asp] [29216] [debug] Bareword found
where operator expected at
/home/httpd/vhosts/comptraders.co.za/httpdocs/pricelist.asp line 170,
near ") Then" <-->
[Fri Aug 12 08:30:49 2005] [error] [client 66.139.72.250] File does not
exist: /home/httpd/vhosts/comptraders.co.za/httpdocs/favicon.ico
[Fri Aug 12 08:32:03 2005] [error] [asp] [29750] [error] Undefined
subroutine &Apache::ASP::Compiles::__ASP__tmpx::Write called at
/home/httpd/vhosts/comptraders.co.za/httpdocs/Specials.asp line 21. <-->
, /usr/lib/perl5/site_perl/5.8.1/Apache/ASP.pm line 1518
[Fri Aug 12 08:32:38 2005] [error] [asp] [29217] [debug] \t(Missing
operator before set?) <-->
[Fri Aug 12 08:32:38 2005] [error] [asp] [29217] [debug] Bareword found
where operator expected at
/home/httpd/vhosts/comptraders.co.za/httpdocs/laptops.asp line 204, near
"' *** Move To Record: if we dont know the record count, check the
display range <--> If (MM_rsCount = -1) Then <--> ' walk" <-->
(Might be a runaway multi-line '' string starting on line 200) <-->
[Fri Aug 12 08:32:38 2005] [error] [asp] [29217] [debug] \t(Missing
operator before walk?) <-->
[Fri Aug 12 08:32:38 2005] [error] [asp] [29217] [debug] Bareword found
where operator expected at
/home/httpd/vhosts/comptraders.co.za/httpdocs/laptops.asp line 206, near
"0 Or" <-->
[Fri Aug 12 08:32:38 2005] [error] [asp] [29217] [debug] \t(Missing
operator before Or?) <-->
[Fri Aug 12 08:32:38 2005] [error] [asp] [29217] [error] error compiling
laptops.asp: Unterminated <> operator at
/home/httpd/vhosts/comptraders.co.za/httpdocs/laptops.asp line 206. <-->
, /usr/lib/perl5/site_perl/5.8.1/Apache/ASP.pm line 1462
Thank you,
this is me
|
|
|
|
|
Are you sure ASP is supported on Apache?
|
|
|
|
|
ASP is SAID to be supported on this site from my supplier, BUT after a lenghty discussion with him, he is going to upgrade (change) the a MS Server and I am sure this will simply sort out my problems on the short and long term. I understand that I COULD have gotten my ode to run on it and all should have been OKish, BUT the experts told me that I would have had problems for ages on it in any case (My supplier sugested that I actually go and REDO everything in PHP.. NO WAY
SOOOO At the end I am waiting since he said a week and he should be on MS IIS servers and I am not changing a thing on my side.
Thanks guys.
this is me
|
|
|
|
|
evlxtc
You are using Apache :: ASP right?
Can you write a simple ASP script called testasp.asp with the following contents
<%
Response.Write "Hello World from Apache ASP"
%>
That way with a simpler stacktrace, we can find out if there are any configuration issues.
Vasudevan Deepak Kumar
Personal Web: http://www.lavanyadeepak.tk/
I Blog At: http://deepak.blogdrive.com/
|
|
|
|
|
I had a simple one called specials.asp on there that does only ONE asp action and it is a simple response.write("NOW") and even that gives me a server error, but like I said, the guy is going to go the IIS route in any case so it is fine. Thanks in any case
this is me
|
|
|
|
|
Hi,
I have a popup page that submits new info to its parent page, once the user clicks update, the following code is triggered.
<br />
window.opener.location.reload()
window.self.close()
The problem now is that I need to send a anchor tag ("#") with the window.opener.location.reload() function, but dont know how to do this. The anchor name is "Progress", and the parent page is showProgRep.aspx
Can someone help me please!!
|
|
|
|
|
If there is no anchor previously, you can just add it:
window.opener.location = window.opener.location.href + '#Progress';
window.close();
---
b { font-weight: normal; }
|
|
|
|