|
-
Sep 20th, 2002, 03:54 AM
#1
Thread Starter
Hyperactive Member
String Declare Error
I have Simple Problem with Declaring Variables. This is my Program.
Code:
<%@ Page Language="VB" %>
<script runat="server">
Dim stm as String
stm="prasad"
</script>
<html>
<head>
</head>
<body>
<form runat="server">
</form>
</body>
</html>
I got the Following Error
Code:
Compiler Error Message: BC30188: Declaration expected.
Source Error:
Line 2: <script runat="server">
Line 3: Dim stm as String
Line 4: stm="prasad"
-
Sep 20th, 2002, 04:10 AM
#2
Hyperactive Member
Have you tried placing the code in a routine?
Private Sub setString()
Dim stm as String
stm="prasad"
End sub
-
Sep 20th, 2002, 04:19 AM
#3
Thread Starter
Hyperactive Member
It is working fine. But
why should Declare the Variable inside the Sub procedure?
any reason..? here the in between of <Server> </server> is Code block only so why not we assign the value over there.?
-
Sep 20th, 2002, 04:20 AM
#4
New Member
Hi Buddu,
Its simple. Just try to place your code, i mean variable assignment should be inside subroutine.You can't assign a variable outside subroutine.
 Have a nice day!
-
Sep 20th, 2002, 08:23 AM
#5
Dim stm as String
stm="prasad"
wont work outside a procedure.
Dim stm as String = "prasad"
will work
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|