Unexpected symbol 'dim' with a OLEDB connection
How do I fix this error? I'm using asp.net
Compilation Error
Description: Error compiling a resource required to service this request. Review your source file and modify it to fix this error.
Compiler Error Message: CS1519: Unexpected symbol `Dim' in class, str开发者_如何转开发uct, or interface member declaration
Source code:
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
Dim dbconn As OleDbConnection
dbconn=New OleDbConnection("Provider=SQLOLEDB;
Data source='http://localhost';
User Id='90782';
Password='@ER#82L(*&!';")
dbconn.Open()
end sub
</script>
PS: Double quote added, but this didn't fix the problem.
you have not closed your double quotes (")
Try This:
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
Dim dbconn As OleDbConnection
dbconn=New OleDbConnection("Provider=SQLOLEDB;
Data source='http://localhost';
User Id='90782';
Password='@ER#82L(*&!';")
dbconn.Open()
end sub
</script>
How about this:
...
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
...
Or this:
<%@ Page Language="VB" %>
精彩评论