Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 15th, 2006, 12:50 AM
Authorized User
 
Join Date: Sep 2005
Location: , , India.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default initialization

Can I do this in asp ?
<% dim strName="xyz" %>
Is is permitted to initiazed variable during declaration in
asp using VB Script ?

I am getting an error message.

One more proble
<dim a,b
a=1+2
b="xx"
response.write(a+b)
%>

I am getting error on the highlighted line

Thanks in advance
vin
Reply With Quote
  #2 (permalink)  
Old April 15th, 2006, 04:44 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii Vin!!
since b="xx" is string
in order to get the value xx3 you need
    response.write(b&a)
 or
   response.write(b+cstr(a))
since when u do response.write(b+a)>>> Type mismatch: '[string: "xx"]'

also use cint,cdbl,cstr etc functions as per ur requirement

Hope this will help you


Cheers :)

vinod
Reply With Quote
  #3 (permalink)  
Old April 16th, 2006, 01:34 AM
Authorized User
 
Join Date: Sep 2005
Location: , , India.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks ,pls can u give me solution for first problem also

Can I initialize variable while delcaring like
dim strName="vin"

Reply With Quote
  #4 (permalink)  
Old April 16th, 2006, 06:40 AM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

No:
dim strName="vin"
Isnt allowed and will give you an error 'Expected end of statement'

You must:
dim strName
strName="vin"

Wind is your friend
Matt
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regarding String Initialization chris@p2p Java Basics 3 April 25th, 2009 01:58 PM
Declaration of variable without initialization v_kewlani Other Programming Languages 0 May 24th, 2007 01:51 AM
textbox initialization in Formview ekwong ASP.NET 2.0 Basics 2 November 17th, 2006 08:30 PM
Property initialization problem VoodooCreator Pro Visual Basic 2005 1 June 29th, 2006 07:56 PM
variable initialization vin_0x1 Classic ASP Databases 1 April 18th, 2006 06:46 AM



All times are GMT -4. The time now is 01:32 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.