J
John Pether
ok, I am trying to make one call to the db and create a datalist and then
populate a datalist and a datagrid with different filtered versions of the
dataset. I presume this is a better way of doing it than making two seperate
calls to the db where I could just use 2 stored procs to filter the data.
Any help or advice if I'm doing it the wrong way would be appreciated.
' Obtain Link information from Links table
Dim links As New DNSite.LinksDB()
Dim myDS As DataSet
myDS = links.GetLinks(CatID)
' filter dataset for premier links
' and bind to the datalist control
plusdl.DataSource = myDS.Tables("tblLinks").Select("TypeName = Premier
Plus")
plusdl.DataBind()
' bind remaining links to DataGrid
premierDG.DataSource = myDS.Tables("tblLinks").Select("TypeName <> Premier
Plus")
premierDG.DataBind()
-----------------------------------
I get the following error:
-----------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 88: ' and bind to the datalist control
Line 89:
Line 90: plusdl.DataSource =
myDS.Tables("tblLinks").Select("TypeName = Premier")
Line 91: plusdl.DataBind()
Source File: **********\DNSLinks.ascx.vb Line: 90
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
ASPNetPortal.DNSLinks.BindGrid() in ********\DNSLinks.ascx.vb:90
ASPNetPortal.DNSLinks.Page_Load(Object sender, EventArgs e) in
********\DNSLinks.ascx.vb:76
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Control.LoadRecursive() +92
System.Web.UI.Control.LoadRecursive() +92
System.Web.UI.Control.LoadRecursive() +92
System.Web.UI.Page.ProcessRequestMain() +724
populate a datalist and a datagrid with different filtered versions of the
dataset. I presume this is a better way of doing it than making two seperate
calls to the db where I could just use 2 stored procs to filter the data.
Any help or advice if I'm doing it the wrong way would be appreciated.
' Obtain Link information from Links table
Dim links As New DNSite.LinksDB()
Dim myDS As DataSet
myDS = links.GetLinks(CatID)
' filter dataset for premier links
' and bind to the datalist control
plusdl.DataSource = myDS.Tables("tblLinks").Select("TypeName = Premier
Plus")
plusdl.DataBind()
' bind remaining links to DataGrid
premierDG.DataSource = myDS.Tables("tblLinks").Select("TypeName <> Premier
Plus")
premierDG.DataBind()
-----------------------------------
I get the following error:
-----------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 88: ' and bind to the datalist control
Line 89:
Line 90: plusdl.DataSource =
myDS.Tables("tblLinks").Select("TypeName = Premier")
Line 91: plusdl.DataBind()
Source File: **********\DNSLinks.ascx.vb Line: 90
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
ASPNetPortal.DNSLinks.BindGrid() in ********\DNSLinks.ascx.vb:90
ASPNetPortal.DNSLinks.Page_Load(Object sender, EventArgs e) in
********\DNSLinks.ascx.vb:76
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Control.LoadRecursive() +92
System.Web.UI.Control.LoadRecursive() +92
System.Web.UI.Control.LoadRecursive() +92
System.Web.UI.Page.ProcessRequestMain() +724