472,371 Members | 1,596 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,371 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 1329
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...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

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.