Wrox Programmer Forums
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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
  #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
  #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"

  #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


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





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