ASP .NET data type problem

Results 1 to 2 of 2

Thread: ASP .NET data type problem

  1. #1
    Join Date
    Dec 1969

    Default ASP .NET data type problem

    I&#039;m getting this error:<BR>Compiler Error Message: BC30002: Type &#039;DataView&#039; is not defined.<BR>When I declare a variable like so:<BR> Dim source as DataView<BR><BR>But DataView is part of the System.Data Namespace which I am importing.<BR><BR>Here is the complete code:<BR><BR>&#060;%@ Page Language="VB" %&#062;<BR>&#060;%@ Import Namespace="System.Data %&#062;<BR>&#060;%@ Import Namespace="System.Data.OleDb" %&#062;<BR><BR>&#060;script runat="server"&#062;<BR> sub page_load(obj as object, e as eventargs)<BR> if not page.ispostback then<BR> CreateData()<BR> end if<BR> end sub<BR><BR> sub CreateData<BR> dim source as DataView<BR> <BR> source = Cache("DataView")<BR><BR> if source is nothing then<BR> dim strConnString as string = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=c:aspnetdataanking.mdb"<BR> dim objCmd as OleDbDataAdapter = new OleDbDataAdapter("select * from tblUsers", strConnString)<BR> dim ds as dataset = new dataset()<BR><BR> objCmd.Fill(ds, "tblUsers")<BR><BR> source = new DataView(ds.Tables("tblUsers"))<BR> Cache("DataView") = source<BR><BR> lblMessage.Text = "Dataset created explicitly"<BR> else<BR> lblMessage.Text = "Dataset retrieved from cache"<BR> end if<BR> <BR> dgData.DataSource = source<BR> dgData.DataBind()<BR> end sub<BR><BR> sub ExpireCache(obj as object, e as eventargs)<BR> dim dv as dataview = Cache.remove("dataview")<BR> CreateData()<BR> end sub<BR><BR>&#060;/script&#062;

  2. #2
    Join Date
    Dec 1969

    Default You're missing a quote.

    &#060;%@ Import Namespace="System.Data %&#062;<BR><BR>S/B<BR><BR>&#060;%@ Import Namespace="System.Data" %&#062;<BR><BR>Which may fix your problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts