Friday, March 16, 2012

Newbie Needs Help

So I am doing the walkthrough on the dynamic help for Visual Studio .net to create a read only data access in a web forms page.

I am coming up with an error and don't know how to fix it... Please help me!!!!

Server Error in '/ReadOnly' Application.
------------------------

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: BC30180: Keyword does not name a type.

Source Error:

Line 31: <System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()> _
Line 32: Public Class Global_asax
Line 33: Inherits ReadOnly.Global
Line 34:
Line 35: Private Shared __initialized As Boolean = false

Source File: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\readonly\cc5ec6d7\7a0c1c27\-u9u0vh1.0.vb Line: 33Please provide code. This will help in determinig the problem...
the code for the page that I have written is

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.OleDbConnection1 = New System.Data.OleDb.OleDbConnection
Me.OleDbCommand1 = New System.Data.OleDb.OleDbCommand
'
'OleDbConnection1
'
Me.OleDbConnection1.ConnectionString = "Integrated Security=SSPI;Packet Size=4096;Data Source=018744S;Tag with column col" & _
"lation when possible=False;Initial Catalog=pubs;Use Procedure for Prepare=1;Auto" & _
" Translate=True;Persist Security Info=False;Provider=""SQLOLEDB.1"";Workstation ID" & _
"=018744S;Use Encryption for Data=False"
'
'OleDbCommand1
'
Me.OleDbCommand1.CommandText = "SELECT au_id, au_fname, au_lname, phone FROM authors"
Me.OleDbCommand1.Connection = Me.OleDbConnection1

End Sub
Protected WithEvents OleDbConnection1 As System.Data.OleDb.OleDbConnection
Protected WithEvents OleDbCommand1 As System.Data.OleDb.OleDbCommand
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
OleDbConnection1.Open()
Dim Reader As System.Data.OleDb.OleDbDataReader
Reader = OleDbCommand1.ExecuteReader()
DataGrid1.DataSource = Reader
DataGrid1.DataBind()
Reader.Close()
OleDbConnection1.Close()
End If
End Sub

Private Sub OleDbConnection1_InfoMessage(ByVal sender As System.Object, ByVal e As System.Data.OleDb.OleDbInfoMessageEventArgs) Handles OleDbConnection1.InfoMessage

End Sub
End Class

0 comments:

Post a Comment