.NETGURU
I am trying to set up caching on this code and I get this error
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngcache' list.


Dennis West
-- Moved from [aspngdata] to [aspngcache] by Let the good times roll <Click here to reveal e-mail address> --

I am trying to set up caching on this code and I get this error

If Page.IsPostBack = False Then

AnnoucementsSource = Cache("Annoucements")
if AnnoucementsSource is nothing Then

Dim myCommand As New SqlDataAdapter("GetListofAnnoucements", myConnection)
myCommand.SelectCommand.CommandType = CommandType.StoredProcedure
' Create and Fill the DataSet
Dim ds As New DataSet()
myCommand.Fill(ds)

AnnoucementsSource = ds
Cache("Annoucements") = AnnoucementsSource
End If
Dropdownlist1.DataSource = AnnoucementsSource
Dropdownlist1.DataBind()

panel1.visible = "true"
panel2.visible = "false"
panel3.visible = "false"
panel4.visible = "false"
panel5.visible = "false"
panel6.visible = "false"
txtSearch.Text = ""

End If
End Sub

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: BC30311: Value of type 'System.Data.DataSet' cannot be converted to 'System.Data.DataView'.

Source Error:

Line 34:                     myCommand.Fill(ds)
Line 35:
Line 36:                     AnnoucementsSource = ds
Line 37:                     Cache("Annoucements") = AnnoucementsSource
Line 38:                 End If

Source File: C:\PortalVBVS\PortalVBVS\DesktopModules\SearchVertical4.ascx Line: 36
For 2002 ASP.NET Solutions & Articles goto:
http://aspalliance.com/dotnetsolutions/

Dennis West
West Design
MS .NET Developer
www. westontheweb.net
Click here to reveal e-mail address

Reply to this message...
 
    
Dennis West
I figure it out. ...This is Fixed
----- Original Message -----
From: "Dennis West" <Click here to reveal e-mail address>
To: "aspngcache" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 4:06 PM
Subject: [aspngcache] I am trying to set up caching on this code and I get
this error

> -- Moved from [aspngdata] to [aspngcache] by Let the good times roll
<Click here to reveal e-mail address> --
[Original message clipped]

details and modify your source code appropriately.
[Original message clipped]

Reply to this message...
 
    
Mohandeep Sahni
Hi,

I think you cannot cache the Dataset, but have to cache DataView only. The
following code from quichstart will help you do that...

Hope it helps.

Regards,
Deep

Sub Page_Load(Src As Object, E As EventArgs)

Dim Source As DataView

' try to retrieve item from cache
' if it's not there, add it

Source = Cache("MyDataSet")

If Source Is Nothing

Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter

MyConnection = New
SqlConnection("server=(local)\NetSDK;database=pubs;Trusted_Connection=yes")
MyCommand = New SqlDataAdapter("select * from Authors",
MyConnection)

Dim ds As New DataSet
myCommand.Fill(ds, "Authors")

Source = New DataView(ds.Tables("Authors"))
Cache("MyDataSet") = Source

CacheMsg.Text = "Dataset created explicitly"
Else
cacheMsg.Text = "Dataset retrieved from cache"
End If

MyDataGrid.DataSource=Source
MyDataGrid.DataBind()
End Sub

----- Original Message -----
From: "Dennis West" <Click here to reveal e-mail address>
To: "aspngcache" <Click here to reveal e-mail address>
Sent: Friday, August 02, 2002 2:36 AM
Subject: [aspngcache] I am trying to set up caching on this code and I get
this error

> -- Moved from [aspngdata] to [aspngcache] by Let the good times roll
<Click here to reveal e-mail address> --
[Original message clipped]

details and modify your source code appropriately.
[Original message clipped]

Reply to this message...
 
 
System.Data.CommandType
System.Data.DataSet
System.Data.DataView
System.Data.SqlClient.SqlConnection
System.Data.SqlClient.SqlDataAdapter
System.EventArgs
System.Web.UI.Page




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification