S
Sam
I want to connect sql database via ado.net but error is encounter as shown
as below:
Compilation Error
=================
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: BC30188: Declaration expected.
Source Error:
=============
Line 7: Dim myCommand As SqlCommand = New SqlCommand("select * from
gldate", myConnection)
Line 8:
Line 9: myConnection.Open()
Line 10:
Line 11:
Show Detailed Compiler Output:
==============================
myConnection.Open()
~~~~~~~~~~~~
D:\SQLDB\Intranet\WebApp\Finance\subsystem\gl\dropdownlist.aspx(15) : error
BC30188: Declaration expected.
myConnection.Close()
~~~~~~~~~~~~
find.aspx
=========
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">
Dim myConnection As SqlConnection = New
SqlConnection("server=(sql01);database=ERP_ARCHIVAL;user
id=intranet;password=intranet")
Dim myCommand As SqlCommand = New SqlCommand("select * from gldate",
myConnection)
myConnection.Open()
Dim dr As SqlDataReader = myCommand.ExecuteReader()
myConnection.Close()
</script>
<html>
<head>
<title>Intranet Information System</title>
</head>
<body>
<form runat="server">
<aspropDownList id="DropDownList1"
runat="server"></aspropDownList>
</form>
</body>
</html>
Please help.
as below:
Compilation Error
=================
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: BC30188: Declaration expected.
Source Error:
=============
Line 7: Dim myCommand As SqlCommand = New SqlCommand("select * from
gldate", myConnection)
Line 8:
Line 9: myConnection.Open()
Line 10:
Line 11:
Show Detailed Compiler Output:
==============================
myConnection.Open()
~~~~~~~~~~~~
D:\SQLDB\Intranet\WebApp\Finance\subsystem\gl\dropdownlist.aspx(15) : error
BC30188: Declaration expected.
myConnection.Close()
~~~~~~~~~~~~
find.aspx
=========
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">
Dim myConnection As SqlConnection = New
SqlConnection("server=(sql01);database=ERP_ARCHIVAL;user
id=intranet;password=intranet")
Dim myCommand As SqlCommand = New SqlCommand("select * from gldate",
myConnection)
myConnection.Open()
Dim dr As SqlDataReader = myCommand.ExecuteReader()
myConnection.Close()
</script>
<html>
<head>
<title>Intranet Information System</title>
</head>
<body>
<form runat="server">
<aspropDownList id="DropDownList1"
runat="server"></aspropDownList>
</form>
</body>
</html>
Please help.