Tracking Forums, Newsgroups, Maling Lists
Home Submit Tracker Forums
  Advanced Search


VS 2010 - Return Data Reader Or Dataset / Datatable

Had a datareader question.


Return myDataReader I have a function which is retuning a datareader to various sections of my website which is then being bound to dropdown lists, gridviews, etc. Normally the last line in a function when is the data reader and connection getting closed? Is it best practive to return a data reader or a dataset/datatable (or something even better than these two)?

View 8 Replies (Posted: Dec 18th, 2010, 02:47 PM)

Sponsored Links:

Related Forum Messages For ASP.NET category:
MVC :: Generic Method To Return DataTable Or DataSet?
I am want to write Generic a metho, that will return DataTable or DataSet as required. How can I achieve using Generics?

Posted: Sep 26, 2009 06:57 PM

View 6 Replies!   View Related
How To Copy Data From Datatable To Dataset.datatable
how to copy data from datatable to table in dataset i ry this but its readonly property


Posted: Oct 31 10 at 9:12

View 1 Replies!   View Related
ADO.NET :: When To Use 'reader' Versus A Datatable, Table Adaptor?
I'm making the leap from using all the 'wizards' that are built into VS, andhave been doing more with code-behinds. But,I'm curious as to when/why I should use a reader, versus a databable, table adaptor to "manage" the data returned from a stored procedure. Typically, the data is tobe displayed ona webpage, and not written back to the database. What's the difference? When should I use one over another?

Posted: Sep 20, 2010 12:33 PM

View 2 Replies!   View Related
DataSource Controls :: Linq Distinct Against A Dataset To Return A Dataset With No Dups?
How can I do a linq distinct against a dataset to return a dataset with no dups.

Posted: Mar 05, 2009 04:34 PM

View 5 Replies!   View Related
SQL Server :: Get Return Value From Server In C# Through Data Reader?
I want to take my return value from sql server to c#.

my code


ALTER procedure [dbo].[userss](@email varchar(100),@password varchar(25),@name varchar(250),@DOB varchar(20),@acc_vari int,@ip_address varchar(50),@vari_code varchar(7) )
declare @uid int
select @uid=uid from users where email='12we'
return 0
insert into users values(@email,@password,@name,@DOB,@acc_vari,@ip_address,@vari_code )

In this i want to take return value "return 0 " from sql server to c#.

Posted: Feb 05, 2011 06:52 PM

View 3 Replies!   View Related
VS 2010 - How To Use The Adobe PDF Reader (AxAcriPDFLib) Control To Display Preview Of PDF Document
In a VB.Net project I use the Adobe PDF Reader (AxAcriPDFLib) control to display a preview of a selected PDF document whereafter the user can double-click upon the selected listbox item to enjoy a full screen view of the relevant PDF document. see the attached sample in this regard. Is there any way to emulate this in ASP.Net?

Posted: Jan 31st, 2011, 11:16 PM

View 5 Replies!   View Related
Storing .xls File Data Into Datatable Or Dataset In C#
IWantstore .xls file data into DataTable andDataSet

Posted: Sep 15, 2009 04:42 AM

View 5 Replies!   View Related
How To Export Data From Dataset/datatable To Excel Using
how to export data from dataset/datatable to excel using binding data to gridview).

Posted: Sep 09, 2009 12:37 PM

View 3 Replies!   View Related
DataSource Controls :: Is Datatable Data Store In Dataset
is datable data store in dataset.. ?

Posted: Apr 24, 2010 10:06 AM

View 1 Replies!   View Related
Forms Data Controls :: Dataset / Datatable According To Pagesize Given?
I need your help / guidence for doing custom paging in c#, through sqlserver. so that i can have data in dataset/datatable according to the pagesize given, not all the data in dataset. some code /url .......with full discrption if possible.

Posted: Mar 26, 2010 05:00 AM

View 12 Replies!   View Related
Forms Data Controls :: Difference Between Binding GV To Dataset / Datatable
If I do as:

Gv1.datasource = ds

or Gv1.datasource = ds.tables(0)

Whats thedifference b/w the two?

Posted: Nov 01, 2009 09:10 PM

View 8 Replies!   View Related
Forms Data Controls :: Use Dataset And Datatable To Bind Data To A Gridview?
on which all conditions we use dataset and datatable to bind data to a gridview?

Posted: Aug 27, 2010 10:32 AM

View 2 Replies!   View Related
Forms Data Controls :: Generic Collection Or Dataset / Datatable - Getting A Data
What is the best way to use when it comes to Getting a Data from Database. Let say I have Millions of Records in my table what is the best way to use it's Collection<> or Dataset/Datatable? Ex:


Posted: Oct 29, 2009 07:26 AM

View 3 Replies!   View Related
Forms Data Controls :: Return Dataset As Datasource For Gridview
I am trying to return a dataset.I must be doing something wrong. The returned dataset in this sample code indicates there is a datatable, Users, but there are no datarows. What am I doing wrong? This example is only using the rows.count, but of course I really need to use the whole datatable as the datasource for a gridview.


Public Function getmyds() As DataSet
Dim dsUser1 As DataSet = New DataSet()
Dim tbUser1 As DataTable = dsUser1.Tables.Add("Users")
tbUser1.Columns.Add("Days Remaining")
Dim rwDefaultUser1 As DataRow = tbUser1.NewRow()
rwDefaultUser1("UserName") = "John Smith"
rwDefaultUser1("Days remaining") = 100
rwDefaultUser1("userAccountControl") = "Enabled"
Return dsUser1
End Function

Posted: Dec 05, 2010 01:34 PM

View 2 Replies!   View Related
Forms Data Controls :: Return Number Of Rows In A Dataset?
I'm using a table adapter to perform my queries. I'm sure I'm missing something really easy, but I can't figure out how to return the number of rows returned from a query to a dataset used for a GridView.Basically, I want to display a message "No records exist for your selection" by testing for ReturnedRows = 0.

Excerpt of C# code:

handoutDSTableAdapters.handoutTableAdapter handoutsAdapter =
new handoutDSTableAdapters.handoutTableAdapter();
gv_Handout.DataSource = handoutsAdapter.GetDataByDoctor(Int32.Parse(ddl_MD.SelectedValue));

Posted: Jan 14, 2010 03:19 AM

View 4 Replies!   View Related
SQL Reporting :: Process The Data Return A DataSet As The Input To The Report?
I have gone through this article at microsoft web site, which deals about calling the custom code in Reporting Services.But I need to know whether it is possible to process the data (call a dll function) and return a DataSet as the input to the report instead of directly binding the dataset. I have gone through many links which deals with custom code that returns the scalar value(such as Boolean, String, Decimal, etc).As I'm using Delivery & Subscription concept, I need the business logic to be called and return the DataSet to be the source for generating report. Please clarify me on this.

Posted: Oct 28, 2009 01:22 PM

View 2 Replies!   View Related
Forms Data Controls :: Bind Data From DataSet (DataTable) To A Selectrow DropDownList In GridView?
I have a Gridview and two link button in that GridView , one link button click is to add edit row ( Edit ), one link button click is to select row ( Select ). I have a dropdownlist inside row which selected when i click link button Select in the gridview edit template, as of my business logic i need to show the dropdownlist only when the user clicks Edit button and when the user clicks Select button . That mean when the user clicks Select button then they clicks Edit button on the gridvview i should allow him to edit the dropdownlist (showing the value to the user through a label).


[Code].... C#

When I click Select link button , then I click Edit link button . They have errors : Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" I don't know what error?. How to fix it

Posted: Nov 19, 2010 06:44 AM

View 3 Replies!   View Related
Forms Data Controls :: How To Add A Data In Datagridview Without Using Datatable Or Dataset
i am using 2008 i need to know about datagridview ......Is it to possible to add a data through vbcode in datagridview without using any datatable or dataset....

Posted: Feb 26, 2011 06:57 AM

View 1 Replies!   View Related
Forms Data Controls :: Import Changes From A Dataset / Datatable To A SQL Server Table
I'm trying to import a dataset/datatable into a SQL Server table that will have changes Ihave aprogram thatcreates two datasets. One dataset comes from SQL Server (original data) and the otheris being imported from Excel (altered data).The user will have made changes to certain cell values within the excel dataset from is on file with the SQL Server table. What I would like to do then is to update SQL Server table with the contents of the dataset/datatable that came from Excel. I know that SQLBulkCopy can do an insert into a temporary table. However, I have 14 tables that I would have to create and also keep track of column changes if the original SQL Server table were to change. Can this be done with doing an update back to the original SQL Server table?

Posted: Oct 08, 2009 01:27 PM

View 2 Replies!   View Related
Forms Data Controls :: Binding Datatable To Grid View Based On A Return From A Tableadapter?
I have no clue what I'm doing wrong here, but I wanted to create a grid view based on a return from a tableadapter.



Also, maybe I should be going about this another way as I wanted to add a drop down to each record and a link to each record.On pointers on how I should do this would be great too.

Posted: Feb 17, 2010 10:50 PM

View 6 Replies!   View Related
ADO.NET :: Can't Get Reader.hasrows And To Work Together In Code Behind
I have some code in my code behind that queries a database, and if there is data, outputs it from the codebehind to a datalist on my page.In addition to sending the data to the datalist on the page, I need to take the value from "mbillaty" that is returned from the sql query, and have that value be the selected value for a drop down box also on the page. I can get either the datalist to fill, or the selected value for the dropdown box to be selected depending upon which bit of code I place before the other (ARGH), but I can't get them to both worktogether on the page. What am I doing wrong?


Posted: Feb 22, 2011 01:34 PM

View 2 Replies!   View Related
Getting Error / Cannot Implicitly Convert Type 'System.Data.DataSet' To 'System.Data.DataTable'
I got this error: Cannot implicitly convert type 'System.Data.DataSet' to 'System.Data.DataTable'

i have writtencode like this


Posted: Dec 24, 2008 11:00 AM

View 2 Replies!   View Related
C# - Use Dataset Or Datatable?
If I need to fetch one whole column from Table1 in the DB, should I fetch it using datatable or dataset? I can do both ways. I mean ok I should use Datatable. Why is that? What would happen if I use Dataset? ok that's what I wanted to know. So there's memory issue. I mean whatever I use be it Datatable or Dataset, both will be fetching only ONE column frommy table in DB. How is Dateset's gonna use more memory then?

Posted: Dec 17 10 at 6:03

View 3 Replies!   View Related
Web Forms :: How To Add A Dataset To A Datatable
Is it possible to add/set the dataset back to a dataTable. The dataset is already populated with the resultant data retrived from three different tables. The reason for this is to be able toloop through the table and create a template column in the table dynamically. I am writing the code in

Posted: Aug 07, 2007 01:57 AM

View 2 Replies!   View Related
Dataset Vs. Returning A Datatable
I have created alot of stored procedures in my application that return the result of a query in a datatable object. I never use a dataset. Why would I ever use a dataset over simply returning the result of a query as a datatable object?

Posted: Aug 15 10 at 2:41

View 3 Replies!   View Related
ADO.NET :: Number Of Datatable In One Dataset Can Contain?
i have one question for my project. i am fetching all users data in one dataset, but each user will be in unique datatable to avoid no. of database connection i will fetch data in one single transaction no. of user are more than 10000 it practical to store more than 10000 tables in one single dataset what will be then performance issue for the same, it will be the diffrent application for my project to generate this much of data. how many no. of table one dataset can contain in visual studio 2008 with 3.5 framework?

Posted: Aug 06, 2010 09:31 AM

View 2 Replies!   View Related
DataTable Already Belongs To Another DataSet?
I have 2 DataTables and 3 DataGrids. First one shows data from first dataset, and second one from second dataset. And the third one shows relational data from those 2 tables. Here is some sample code (

Private Sub Page_Load .........
Dim dss As New DataSet
dss.DataSetName = "dset1"
Dim dt1As New DataTable
dt1.TableName = "tablo1"
dt1= c2data.En_Cok_Satilan_Getir 'function returns datatable from DAL
Dim dt2As New DataTable
dt2.TableName = "tablo2"
dt2= c2data.En_Cok_Alinan_Getir 'function returns datatable from DAL
dss.Relations.Add("baglanti", dss.Tables("tablo2").Columns("stok_kodu"), dss.Tables("tablo1").Columns("stok_kodu"))
' other codes goes here
End Sub

When I load the page for the first time, everything works fine, all 3 DataGrids shows proper results. But when I refreshthe page by hitting"refresh" button or by hitting F5, I am getting "DataTable already belongs to another DataSet" error message for "dss.Tables.Add(dt1)" line. I can solve this problem by using copy of that table ("dss.Tables.Add(dt1.Copy)". And then "dss.Tables.Add(dt2)" gives me same error message. Again, I can solve this with same method "dss.Tables.Add(dt2.Copy)".

What I would like to know is, which dataset owns my datatables and why doesnt it released and retains for the second request?Refreshing page re-creates new datatables and new dataset, doesnt it?

Posted: Oct 17, 2005 10:50 PM

View 10 Replies!   View Related
ADO.NET :: How To Return Dataset Using Oracleparametes In C#
How to return dataset using oracleparametes in c#

I have a method like this


Posted: Mar 30, 2011 07:32 AM

View 2 Replies!   View Related
User Control Return Datatable?
I am trying to make a user control which has a gridview bound to a sql datasource.On the gridview user control, a user would select some fruits and press insert button and the user control would return a datatable/dataset of the selected items which then get databound to a gridview on the parent page. 1) I have made the user control with the gridview and buttons Included it on form and its working fine3) How to return a datatable from my user control and bind it with the parent page gridview?

Posted: May 18, 2010 08:26 AM

View 2 Replies!   View Related
VS 2010 - How To Do A Query From A Dataset
Can you do a query from a dataset?


Dim cmd As New SqlCommand
cmd.Connection = New SqlConnection(<connectionString here>)
cmd.CommandText = "Select * From table_name"
Dim da As New SqlDataAdapter(cmd.CommandText, cmd.Connection)
Dim ds As New DataSet
da.Fill(ds) ' I want to do some query with THIS dataset

I want to do a query based on the dataset ds. Let's say I want to filter out names that starts with "a". If yes, how do you do it?

Posted: Aug 19th, 2010, 01:03 AM

View 11 Replies!   View Related
Can Scope Of Dataset Or Datatable Be Public
I am trying to eliminate multiple calls to a SQL database from the same page. I create a dataset and data table, but it is only available to the function that creates it. How can I continue to use it with other functions in the code behind on the same page? Is there a way to make it public like a variable? I don't want to display a datagrid on the page.

Posted: May 14, 2009 03:29 PM

View 5 Replies!   View Related
ADO.NET :: Delete A Row In Datatable Using Linq To Dataset
how can i delete a row in datatable using linq to dataset?

I have a dataset in my project, need to delete some rows filtered by ID

how can i do?

Posted: Aug 31, 2010 07:54 PM

View 5 Replies!   View Related
Send A Dataset Or Datatable Using URL Post?
Is there a way to send a Dataset or Datatable using URL Post???

Posted: Jun 02, 2009 12:59 PM

View 4 Replies!   View Related
Sort The Datatable After Binding The Dataset?
How to Sort The datatable in after binding the dataset values i have stored into one table how can i sort the values of the dataset in with C#

Posted: Apr 16, 2010 11:43 AM

View 4 Replies!   View Related
WCF / ASMX :: Cannot Return Typed Datatable From WebService
I can fill and thenreturn typed dataset from a web method, butapplying these steps by using Typed Datatable instead of Typed DatasetI cannot return filled typed dataTable.So, is it possible to return typed dataTable from a web method? If yes, how can I do this?

I shall give a little bit information about my project. There is 3 project in my solution.
I) Presentation Layer (WinForm), II) Business Layer (Web Service) ,
III) Data Access Layer (Win form project type)... The problem is that;

I use 2 seperate methods. 1st is FillTable() which fill a datatable in my Typed Dataset in Data Access layer. The 2nd isGetTable() which should return typed datatable filled by FillTable() method. I try these methods and FillTable() methods (goes from I. layer to II. Layer and then III. layer) fills a datatable properly and after that I can return this datatable by calling GetTable() method from Typed Dataset (in III. layer) to WebService. I have tested the rows count of returning datatable and there is no problem up to WebService. But even after returning this typed datatable from WebService the table comes to Presentation Layer empty. So, there is a problem returning filled typed datatable from WebService to WebForm (from II. layer to I. layer).

On the other hand, if I try this methods by returning Typed Dataset instead of Typed Datatable, I can return properly with a filled datatable in Typed Dataset. But, I relly do not want to return a huge filled dataset which may contain 15 tables instead of one datatable. My questions;

1) Is there any logical approach mistake on my Layer Architecture?

2) What should I do in order to get a Typed Datatable from Web Service (II. Layer of my project)?

Posted: Jul 14, 2010 09:03 PM

View 5 Replies!   View Related
DataSource Controls :: Pulling From Dataset XSD To Datatable With C#?
I am trying to pull data from a table apdater i have in a XSD file, the xsd file pulls information from a sql express db file. i have been taught thats a good way for n tier archecture and the lecture insists its done this way, I am trying to learn C# as I feel I have learnt enough VB and would prefer to go the C# route.

Here is the VB code I wrote:

' Create the table adapter Dim ta As New DataSet1TableAdapters.CustomersTableAdapter
' Create a Datatable Dim dt As New Data.DataTable Pull the data from the table adapter into the Datatable


Posted: Feb 12, 2009 11:04 PM

View 5 Replies!   View Related
How To Populate Google Charts Using Dataset / Datatable
How to populate google charts using ASP.NET Dataset/Datatable

Posted: Feb 24 at 14:31

View 1 Replies!   View Related
C# - How To Use SqlDataSource For Filling Combobox As Well As Datatable Or Dataset
I am trying to fetch a column value from a datasource when some value is selected from a dropdownlist on its change event.


Here I want to fetch any other column's value that is not binded to a ddlCityName from sqldatasource.

I have four columns in datasource i.e. name, id, address, phno.

I want to fetch an address of a person who selects some value from ddl.

Posted: Apr 30 10 at 6:00

View 1 Replies!   View Related
ADO.NET :: How To Create A Datatable With 2 Datatables In Dataset Programmatically
I have 2 views in sql server and I create a dataset with those 2 views as datatables. Now I need to create a datatable and programmatically fill it with the other 2 datatables. Take the 2 datatable and create a third one in the dataset not create a third view in sql server.

Posted: Apr 01, 2011 11:11 AM

View 2 Replies!   View Related
Copyright 2005-08, All rights reserved