473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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=Microsoft.Jet.OLEDB.4.0;Da ta
Source=D:\access\nemi.mdb")
Line 12:
Line 13:
Source File: D:\Inetpub\wwwroot\aspnet\Begin\Chapter07\access2. aspx Line:
11

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

This is the code:
<%@ Page Language="VB" %>
<%@ import namespace="System.Data"%>
<%@ import namespace="System.Data.SqlClient"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Dim db As SqlConnection
Dim comm As SqlCommand
Dim dtreader As SqlDataReader
db = new SqlConnection("Provider=Microsoft.Jet.OLEDB.4.0;Da ta
Source=D:\access\nemi.mdb")
</script>
May 8 '06 #1
2 2293
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=Microsoft.Jet.OLEDB.4.0;Da ta
Source=D:\access\nemi.mdb")
Line 12:
Line 13:
Source File: D:\Inetpub\wwwroot\aspnet\Begin\Chapter07\access2. aspx Line:
11

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

This is the code:
<%@ Page Language="VB" %>
<%@ import namespace="System.Data"%>
<%@ import namespace="System.Data.SqlClient"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Dim db As SqlConnection
Dim comm As SqlCommand
Dim dtreader As SqlDataReader
db = new SqlConnection("Provider=Microsoft.Jet.OLEDB.4.0;Da ta
Source=D:\access\nemi.mdb")
</script>

May 8 '06 #2
Thanks

"Göran Andersson" <gu***@guffa.com> wrote in message
news:%2****************@TK2MSFTNGP04.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=Microsoft.Jet.OLEDB.4.0;Da ta Source=D:\access\nemi.mdb")
Line 12:
Line 13:
Source File: D:\Inetpub\wwwroot\aspnet\Begin\Chapter07\access2. aspx Line: 11

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

This is the code:
<%@ Page Language="VB" %>
<%@ import namespace="System.Data"%>
<%@ import namespace="System.Data.SqlClient"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Dim db As SqlConnection
Dim comm As SqlCommand
Dim dtreader As SqlDataReader
db = new SqlConnection("Provider=Microsoft.Jet.OLEDB.4.0;Da ta
Source=D:\access\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
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...
1
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...
5
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
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...
21
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...
1
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...
7
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...
2
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 : $...
6
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...
3
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;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.