Login
Register
Tutorials
Forum
Career Development
Resources
Reviews
Jobs
Interview
Communities
Projects
Training
Silverlight Games
|
Bookmarks
|
New Members FAQ
|
Mentor
|
Code Converter
|
IT Companies
|
Peer Appraisal
|
Members
|
Revenue Sharing
|
Computer Jokes
|
New Posts
|
Social
|
Talk to Webmaster
Tony John
Facebook
Google+
Twitter
LinkedIn
Online Members
A'zlina
More...
Join our online
Google+ community
for Bloggers, Content Writers and Webmasters
Forums
»
.NET
»
ASP.NET
»
Excelsheet
Posted Date:
13 Dec 2007
Posted By::
Sunil Reddy
Member Level:
Silver
Member Rank:
2676
Points
: 2
Responses:
2
THis code is giving Error :OBject reference is not set to an instance of an object
Dim objDS As New DataSet
Dim objDT As New DataTable
'Create a dataset as required
objDT = objDS.Tables(0)
objDT.Columns("Employee_Name").ColumnName = "Employee"
objDT.Columns("Customer_Name").ColumnName = "Customer"
objDT.Columns("Visit_Count").ColumnName = "Visit Count"
Dim stwWriter As System.IO.StringWriter = New System.IO.StringWriter
Dim htwWriter As System.Web.UI.HtmlTextWriter = New System.Web.UI.HtmlTextWriter(stwWriter)
Dim dgGrid As DataGrid = New DataGrid
dgGrid.DataSource = objDS
dgGrid.HeaderStyle.Font.Bold = True
dgGrid.Width.Percentage(100)
dgGrid.DataBind()
dgGrid.RenderControl(htwWriter)
Response.ContentType = "application/vnd.ms-excel"
Me.EnableViewState = False
Response.Write(stwWriter.ToString)
Response.End()
Tweet
Responses
#169557 Author:
KVGaneshBabu
Member Level:
Gold
Member Rank:
128
Date: 13/Dec/2007 Rating:
Points
: 2
Cause that you are passing value would be null. Check passing values as without null or "";
Regards,
KVGaneshBabu
#169668 Author:
VASANTH R
Member Level:
Gold
Member Rank:
309
Date: 13/Dec/2007 Rating:
Points
: 2
'Create a dataset as required
objDT = objDS.Tables(0)
objDT.Columns("Employee_Name").ColumnName = "Employee"
objDT.Columns("Customer_Name").ColumnName = "Customer"
objDT.Columns("Visit_Count").ColumnName = "Visit Count"
this is the not right way to create a datatable
first Create datacolumns and add it dt
Then add the dt to dataset
Regards,
R.Vasanth
Post Reply
This thread is locked for new responses. Please post your comments and questions as a
separate thread
.
If required, refer to the URL of this page in your
new post
.
Tweet
Next :
How to transfer one page data onto another page without using viewstate,session,cookies in asp.net
Previous :
datagrid
Return to Discussion Forum
Post New Message
Category:
Related Messages
Validation Controls
no of click on advertisement in asp.net application
Please Please help.................. tooo urgent
Please tell me .Net interview Questions for 2+ Years Exp
To upload Documents like(doc,pdf,etc) to file system
Follow us on Twitter:
https://twitter.com/dotnetspider
Active Members
Today
srirama
(22)
Phagu Mahato
(11)
baskar
(7)
Last 7 Days
baskar
(300)
Asheej T K
(203)
srirama
(185)
more...
Awards & Gifts
Email subscription
.NET Jobs
.NET Articles
.NET Forums
Articles Rss Feeds
Forum Rss Feeds
About Us
Contact Us
Copyright
Privacy Policy
Terms Of Use
Revenue Sharing sites
Advertise
Talk to
Tony John
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2012 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.