473,698 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_C lick(ByVal sender As System.Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles btnDownloadDB.C lick
Dim papdatabase As New DataSet
Dim cmdSelect As New System.Data.Ole Db.OleDbCommand ("SELECT
members.organiz ation,membernam es.fname,member names.lname,mem bers.address1,m embers.address2 ,members.city,m embers.state,me mbers.zip,membe rs.phone,member s.email,members .fax,members.we bsite
FROM members INNER JOIN membernames ON
members.memberi d=membernames.m emberid", New
OleDb.OleDbConn ection("PROVIDE R=Microsoft.Jet .OLEDB.4.0;DATA SOURCE=" &
Server.MapPath( "/papresenters.md b")))
Dim dataadapterSele ct As New System.Data.Ole Db.OleDbDataAda pter
dataadapterSele ct.SelectComman d = cmdSelect
dataadapterSele ct.Fill(papdata base)

Response.ClearC ontent()
Response.Conten tType = "text/plain"
Response.AddHea der("content-disposition",
"attachment;fil ename=members.t xt")
Const TAB As String = Chr(9)
Response.Write( "ORGANIZATI ON" & 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.Dat aRow In papdatabase.Tab les(0).Rows
Response.Write( ControlChars.Ne wLine & CStr(member("or ganization")) &
TAB & CStr(member("fn ame")) & " " & CStr(member("ln ame")) & TAB &
CStr(member("ad dress1")) & TAB & CStr(member("ad dress2")) & TAB &
CStr(member("ci ty")) & TAB & CStr(member("st ate")) & TAB &
CStr(member("zi p")) & TAB & CStr(member("ph one")) & TAB &
CStr(member("em ail")) & TAB & CStr(member("fa x")) & TAB &
CStr(member("we bsite")))
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 -->

<configuratio n>
<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 "defaultRedirec t" attribute of the application's
<customErrors > configuration tag to point to a custom error page URL.

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

<configuratio n>
<system.web>
<customErrors mode="RemoteOnl y" 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********@hotm ail.com
http://www.nathansokalski.com/
Nov 19 '05 #1
1 1411
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********@hot mail.com> wrote in message
news:OA******** ******@TK2MSFTN GP10.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_C lick(ByVal sender As System.Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles btnDownloadDB.C lick
Dim papdatabase As New DataSet
Dim cmdSelect As New System.Data.Ole Db.OleDbCommand ("SELECT
members.organiz ation,membernam es.fname,member names.lname,mem bers.address1,m e
mbers.address2, members.city,me mbers.state,mem bers.zip,member s.phone,members .
email,members.f ax,members.webs ite FROM members INNER JOIN membernames ON
members.memberi d=membernames.m emberid", New
OleDb.OleDbConn ection("PROVIDE R=Microsoft.Jet .OLEDB.4.0;DATA SOURCE=" &
Server.MapPath( "/papresenters.md b")))
Dim dataadapterSele ct As New System.Data.Ole Db.OleDbDataAda pter
dataadapterSele ct.SelectComman d = cmdSelect
dataadapterSele ct.Fill(papdata base)

Response.ClearC ontent()
Response.Conten tType = "text/plain"
Response.AddHea der("content-disposition",
"attachment;fil ename=members.t xt")
Const TAB As String = Chr(9)
Response.Write( "ORGANIZATI ON" & 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.Dat aRow In papdatabase.Tab les(0).Rows
Response.Write( ControlChars.Ne wLine & CStr(member("or ganization")) & TAB & CStr(member("fn ame")) & " " & CStr(member("ln ame")) & TAB &
CStr(member("ad dress1")) & TAB & CStr(member("ad dress2")) & TAB &
CStr(member("ci ty")) & TAB & CStr(member("st ate")) & TAB &
CStr(member("zi p")) & TAB & CStr(member("ph one")) & TAB &
CStr(member("em ail")) & TAB & CStr(member("fa x")) & TAB &
CStr(member("we bsite")))
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 -->

<configuratio n>
<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 "defaultRedirec t" attribute of the application's <customErrors > configuration tag to point to a custom error page URL.

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

<configuratio n>
<system.web>
<customErrors mode="RemoteOnl y" 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********@hotm ail.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
2258
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 at a page.I have a search criteria to search the records based on the data range i give This is what i have done, in the !IsPostBack section. I am setting up the oracle connection, creating dataset object, datadapter and i aslo load the data...
8
2910
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"> <HeaderTemplate><table> </HeaderTemplate> <ItemTemplate>
1
1535
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 Page_Load(Src As Object, e As EventArgs) ' Create a connection to the SQL Server myConnection = New SqlConnection("Data Source=SERVER;" _
14
2123
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 grid and write to the database and I set the new Primary Keys and related Fields to the new asigned atuonumbers in the Access.
1
1037
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 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...
7
3457
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 'UpdateRegistrant' expects parameter '@EMail', which was not supplied. The field value was null in the database and not changed in the FormView so is null going back into the stored procedure. I'm stumped and would greatly appreciate any suggestions.
2
2592
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 out the work. The order of work is as follows: 1. Retrieve the data from primary data source 2. Update UI with retrieved data - this is accomplished by passing a dataset as an event parameter
6
3795
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 LoadDataRow method. After adding the row I just update 4-5 columns out of 20 columns in the row. After entire looping I fire the AcceptChanges method on data table. After this I am trying to update this data back to database in two ways - 1) Merge...
2
1643
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 for the result of these webservice calls, Each night this code calls some webservices, which return a result I need to store in
0
8608
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9161
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9029
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7732
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6522
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.