473,385 Members | 1,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem Getting Data From DataSet

I have retrieved data from a database using a SELECT statement that includes
an INNER JOIN. The data seems to be retrieved to the DataSet OK, but I am
having trouble getting the data from the DataSet. The code I am using is as
follows:
Private Sub btnDownloadDB_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles btnDownloadDB.Click
Dim papdatabase As New DataSet
Dim cmdSelect As New System.Data.OleDb.OleDbCommand("SELECT
members.organization,membernames.fname,membernames .lname,members.address1,members.address2,members.c ity,members.state,members.zip,members.phone,member s.email,members.fax,members.website
FROM members INNER JOIN membernames ON
members.memberid=membernames.memberid", New
OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLED B.4.0;DATA SOURCE=" &
Server.MapPath("/papresenters.mdb")))
Dim dataadapterSelect As New System.Data.OleDb.OleDbDataAdapter
dataadapterSelect.SelectCommand = cmdSelect
dataadapterSelect.Fill(papdatabase)

Response.ClearContent()
Response.ContentType = "text/plain"
Response.AddHeader("content-disposition",
"attachment;filename=members.txt")
Const TAB As String = Chr(9)
Response.Write("ORGANIZATION" & TAB & "FNAME LNAME" & TAB & "ADDRESS1" &
TAB & "ADDRESS2" & TAB & "CITY" & TAB & "STATE" & TAB & "ZIP" & TAB &
"PHONE" & TAB & "EMAIL" & TAB & "FAX" & TAB & "WEBSITE")
For Each member As System.Data.DataRow In papdatabase.Tables(0).Rows
Response.Write(ControlChars.NewLine & CStr(member("organization")) &
TAB & CStr(member("fname")) & " " & CStr(member("lname")) & TAB &
CStr(member("address1")) & TAB & CStr(member("address2")) & TAB &
CStr(member("city")) & TAB & CStr(member("state")) & TAB &
CStr(member("zip")) & TAB & CStr(member("phone")) & TAB &
CStr(member("email")) & TAB & CStr(member("fax")) & TAB &
CStr(member("website")))
Next
Response.End()
End Sub
This gives me the following error:
Server Error in '/' Application.
--------------------------------------------------------------------------------

Runtime Error
Description: An application error occurred on the server. The current custom
error settings for this application prevent the details of the application
error from being viewed remotely (for security reasons). It could, however,
be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable
on remote machines, please create a <customErrors> tag within a "web.config"
configuration file located in the root directory of the current web
application. This <customErrors> tag should then have its "mode" attribute
set to "Off".

<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>

Notes: The current error page you are seeing can be replaced by a custom
error page by modifying the "defaultRedirect" attribute of the application's
<customErrors> configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>

Based on the tests I managed to do, the problem seems to be in the For Each
loop near the end, when I comment out this loop everything goes fine. What
am I doing wrong? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 19 '05 #1
1 1393
You should enable debugging on that page (or set debug mode to RemoteOnly,
log into the box, & hit the page). That will show you the exact line & error
string, which should quickly show you exactly what the issue is.

--
Benjamin Strackany
http://www.developmentnow.com
"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
I have retrieved data from a database using a SELECT statement that includes an INNER JOIN. The data seems to be retrieved to the DataSet OK, but I am
having trouble getting the data from the DataSet. The code I am using is as follows:
Private Sub btnDownloadDB_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles btnDownloadDB.Click
Dim papdatabase As New DataSet
Dim cmdSelect As New System.Data.OleDb.OleDbCommand("SELECT
members.organization,membernames.fname,membernames .lname,members.address1,me
mbers.address2,members.city,members.state,members. zip,members.phone,members.
email,members.fax,members.website FROM members INNER JOIN membernames ON
members.memberid=membernames.memberid", New
OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLED B.4.0;DATA SOURCE=" &
Server.MapPath("/papresenters.mdb")))
Dim dataadapterSelect As New System.Data.OleDb.OleDbDataAdapter
dataadapterSelect.SelectCommand = cmdSelect
dataadapterSelect.Fill(papdatabase)

Response.ClearContent()
Response.ContentType = "text/plain"
Response.AddHeader("content-disposition",
"attachment;filename=members.txt")
Const TAB As String = Chr(9)
Response.Write("ORGANIZATION" & TAB & "FNAME LNAME" & TAB & "ADDRESS1" & TAB & "ADDRESS2" & TAB & "CITY" & TAB & "STATE" & TAB & "ZIP" & TAB &
"PHONE" & TAB & "EMAIL" & TAB & "FAX" & TAB & "WEBSITE")
For Each member As System.Data.DataRow In papdatabase.Tables(0).Rows
Response.Write(ControlChars.NewLine & CStr(member("organization")) & TAB & CStr(member("fname")) & " " & CStr(member("lname")) & TAB &
CStr(member("address1")) & TAB & CStr(member("address2")) & TAB &
CStr(member("city")) & TAB & CStr(member("state")) & TAB &
CStr(member("zip")) & TAB & CStr(member("phone")) & TAB &
CStr(member("email")) & TAB & CStr(member("fax")) & TAB &
CStr(member("website")))
Next
Response.End()
End Sub
This gives me the following error:
Server Error in '/' Application.
-------------------------------------------------------------------------- ------
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application
error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web
application. This <customErrors> tag should then have its "mode" attribute
set to "Off".

<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>

Notes: The current error page you are seeing can be replaced by a custom
error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web>
</configuration>

Based on the tests I managed to do, the problem seems to be in the For Each loop near the end, when I comment out this loop everything goes fine. What
am I doing wrong? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Venkat Chellam | last post by:
I have a peculiar problem. I have a simple web application which loads some data from the oracle table and display in the datagrid in the webpage and datagrid has page enabled which shows 10 rows...
8
by: I am Sam | last post by:
Hi everyone, This problem is making me old. I don't want to get any older. I have a multi-nested repeater control as follows: <asp:Repeater ID="clubRep1" Runat="server">...
1
by: Eustice Scrubb | last post by:
I'm trying to use the Insert.aspx Quickstart and I'm getting a NULL pointer exception. Any help? <code> <script language="VB" runat="server"> Dim myConnection As SqlConnection Sub...
14
by: Lars Netzel | last post by:
A little background: I use three Datagrids that are in a child parent relation. I Use Negative Autoincrement on the the DataTables and that's workning nice. My problem is when I Update these...
1
by: Nathan Sokalski | last post by:
I have retrieved data from a database using a SELECT statement that includes an INNER JOIN. The data seems to be retrieved to the DataSet OK, but I am having trouble getting the data from the...
7
by: Dabbler | last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the following error when trying to update (ExecuteNonQuery): System.Data.SqlClient.SqlException: Procedure or Function...
2
by: Carl Heller | last post by:
Working in VS2003, .Net 1.1 I'm working on a project where I compare data between two databases. This is a lengthy process, and very data intensive, so I decided to create a class, and thread...
6
by: Suresh | last post by:
Hi All, I am fetching a dataset from the database under some condition. After this I create a data table. Traverse in the original dataset & add each row to created data table as it is through...
2
by: Jeff | last post by:
Hey ..NET 2.0 I'm developing an application which will perform some webservice calls and I believe having those calls in a separate thread may help the app run smoother No user are waiting...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.