473,956 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error: Declaration expected

Hi,

When executing this (asp.net 2.0), i get the error:
Compiler Error Message: BC30188: Declaration expected.
Line 9: Dim dtreader As SqlDataReader
Line 10:
Line 11: db = new Sqlconnection(" Provider=Micros oft.Jet.OLEDB.4 .0;Data
Source=D:\acces s\nemi.mdb")
Line 12:
Line 13:
Source File: D:\Inetpub\wwwr oot\aspnet\Begi n\Chapter07\acc ess2.aspx Line:
11

but db is declared with: Dim db As SqlConnection??
Thanks
Phil

This is the code:
<%@ Page Language="VB" %>
<%@ import namespace="Syst em.Data"%>
<%@ import namespace="Syst em.Data.SqlClie nt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<script runat="server">
Dim db As SqlConnection
Dim comm As SqlCommand
Dim dtreader As SqlDataReader
db = new SqlConnection(" Provider=Micros oft.Jet.OLEDB.4 .0;Data
Source=D:\acces s\nemi.mdb")
</script>
May 8 '06 #1
2 2324
You have to put the code inside a method.

phil wrote:
Hi,

When executing this (asp.net 2.0), i get the error:
Compiler Error Message: BC30188: Declaration expected.
Line 9: Dim dtreader As SqlDataReader
Line 10:
Line 11: db = new Sqlconnection(" Provider=Micros oft.Jet.OLEDB.4 .0;Data
Source=D:\acces s\nemi.mdb")
Line 12:
Line 13:
Source File: D:\Inetpub\wwwr oot\aspnet\Begi n\Chapter07\acc ess2.aspx Line:
11

but db is declared with: Dim db As SqlConnection??
Thanks
Phil

This is the code:
<%@ Page Language="VB" %>
<%@ import namespace="Syst em.Data"%>
<%@ import namespace="Syst em.Data.SqlClie nt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<script runat="server">
Dim db As SqlConnection
Dim comm As SqlCommand
Dim dtreader As SqlDataReader
db = new SqlConnection(" Provider=Micros oft.Jet.OLEDB.4 .0;Data
Source=D:\acces s\nemi.mdb")
</script>

May 8 '06 #2
Thanks

"Göran Andersson" <gu***@guffa.co m> wrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
You have to put the code inside a method.

phil wrote:
Hi,

When executing this (asp.net 2.0), i get the error:
Compiler Error Message: BC30188: Declaration expected.
Line 9: Dim dtreader As SqlDataReader
Line 10:
Line 11: db = new Sqlconnection(" Provider=Micros oft.Jet.OLEDB.4 .0;Data Source=D:\acces s\nemi.mdb")
Line 12:
Line 13:
Source File: D:\Inetpub\wwwr oot\aspnet\Begi n\Chapter07\acc ess2.aspx Line: 11

but db is declared with: Dim db As SqlConnection??
Thanks
Phil

This is the code:
<%@ Page Language="VB" %>
<%@ import namespace="Syst em.Data"%>
<%@ import namespace="Syst em.Data.SqlClie nt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<script runat="server">
Dim db As SqlConnection
Dim comm As SqlCommand
Dim dtreader As SqlDataReader
db = new SqlConnection(" Provider=Micros oft.Jet.OLEDB.4 .0;Data
Source=D:\acces s\nemi.mdb")
</script>

May 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
10323
by: Franko | last post by:
I get the following error. Please help c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,38): error CS1001: Identifier expected c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,52): error CS1002: ; expected c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(7,19): error CS1519: Invalid token '(' in class, struct, or interface member declaration c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(9,2): error CS0116: A namespace does not...
1
2311
by: Franko | last post by:
I get the following error. Please help c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,38): error CS1001: Identifier expected c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,52): error CS1002: ; expected c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(7,19): error CS1519: Invalid token '(' in class, struct, or interface member declaration c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(9,2): error CS0116: A namespace does not...
5
5703
by: cranium.2003 | last post by:
hi, Here is my code #include <iostream.h> int main() { cout <<"HI"; return 0; } and using following command to compile a C++ program g++ ex1.cpp -o ex1
4
3039
by: rach | last post by:
I just started to learn C++. I copied the following code from a data structure textbook to a ".h" file and couldn't compile it. The code contains three template interfaces. One inherits another. The functions in the interfaces are defined in book, while the nested-class part is added by me. The reason is that if I don't declare a nested class, say Position, how could it be passed as arguments to those defined functions? However, it seems that...
21
35592
by: Ram Prasad | last post by:
I am trying to write a simple libspf2 plugin code for my postfix ( milter) I am getting this unhelpful error message when I try to compile gcc -g1 -Wall -I/usr/local/include/spf2 -I. -c mfunc.c In file included from mfunc.c:1: mfunc.c:42: error: expected ')' before '*' token make: *** Error 1 my mfunc.c has on the line 42
1
2830
by: BSand0764 | last post by:
I'm getting an error that I can't seem to resolve. When I compile the Functor related logic in a test program, the files compile and execute properly (see Listing #1). However, when I incorporate the same logic within my simulation, the class that implements the functor logic has problems compiling. I get the following errors: -- Building myTest.cpp --
7
70333
by: singhPrabhat | last post by:
Hi, I am using gcc (GCC) 4.2.1 (SUSE Linux). SUSE 10.3 While compiling a .c file I get following error :::: CCWebConfiguration.h:70: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘extern’ CCWebBrowser.c: In function ‘main’:
2
6380
by: akhilesh.noida | last post by:
I am trying to compile glibc-2.5 for ARM based board. But I am getting errors while configuring it. Please check and give your inputs for resolving this. configure command : $ ../glibc-2.5/configure --prefix=/mnt/new/Mars/glibc_HQ_test/GLIBC/ install/ --with-__thread --enable-kernel=2.6.11 --enable-shared
6
14739
by: samsneelam | last post by:
Hi.. This is samuel, while doing a program, i encountered this problem.. Let me give you clarity regarding my prob.. I am having two files .. one is mpcplib.h it contains the follwing declerations.... #include <queue> #include <vector> #include <string> class database { queue<delayTP> delayThrouput;
3
4010
by: Hill | last post by:
This is an simple map, just an exercise. Who can help me fix this compile issue?Thanks in advance. #include <string> #include <vector> #include <iostream> using std::vector; using std::string; using std::cout; using std::endl;
0
10031
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11654
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11265
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11441
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10746
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7487
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6397
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3606
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.