.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Confued in Data Reader ,Data Adapter

Posted By:      Posted Date: October 13, 2010    Points: 0   Category :ASP.Net


I Confued in Data Reader ,Data Adapter and data set

Any One Descrbe Each In Simple Language ,,

Plsese Help Me ,,

How They Are Used ..


View Complete Post

More Related Resource Links

Data Reader Destination issue

Hi, I'm new to BI, I created a package to test the data reader destination the dtsx is executing well every thing is green but what after that. The question is how to use this Data reader destination? As I know as a .net programmer there  is a class named data reader that could be used to retieve data in connected mode programmatically using a  connection and a command objects, but in the case of data reader destination how to use it. Or am I confusing the data reader that I kno in the ADO .Net with this one used in BIDS  Should I add a script task after the data reader destination or should I consume this data reader within my proper separate code with a dll or an exe that I create as a .Net project ? For instance, two properties are remaquables for me those are locted within the custom proeprties  datareader and  usercomponentdatatype   The complexity resides in the simplicity

'System.Data.SqlClient.SqlParameterCollection' does not contain a definition for 'reader' and no

I thought I'd be able to re-use reader to exec one stored procedure, get a value, and then run another stored procedure.  But, argh, I'm getting this error 'System.Data.SqlClient.SqlParameterCollection' does not contain a definition for 'reader' and no extension method 'reader' accepting a first argument of type 'System.Data.SqlClient.SqlParameterCollection' could be found (are you missing a using directive or an assembly reference?) protected void getSectionContent() { SqlConnection conn = default(SqlConnection); SqlCommand comm = default(SqlCommand); SqlDataReader reader = default(SqlDataReader); string connectionString = ConfigurationManager.ConnectionStrings["123456"].ConnectionString; conn = new SqlConnection(connectionString); comm = new SqlCommand(); comm.Connection = conn; comm.CommandType = System.Data.CommandType.StoredProcedure; comm.CommandText = "proc_GetSectionDetails"; comm.Parameters.AddWithValue("SubSectionID", Request.QueryString["SubSectionID"]); conn.Open(); reader = comm.ExecuteReader(); if (reader.Read()) { lblName.Text = Convert.ToString(reader["SubSectionName"]); lblDesc.Text = Convert.ToString(reader["SubSe

data reader problem


i have a sql table like

name      toffees

rajeev     12

raj           14

rajeev     16

now  the following code i have in aspx.cs

sqlcommad cmd=n ew sqlcommad("select sum(toffee) from table where name='ravi'");

sqldatareader dr=cmd.executereader();









problem cms here even there is no name in table with ravi still dr reads when i debug my programm and show me null excepton as it returns null value form table.why it is not going in else part


someone pls help me??????????

Why does "reader" in my c# codebehind skip the first row of data when binding to a gridview?


Argh.. I'm making the switch from vb.net to c#, and am just trying to bind some data from a reader in my c # codebehind, but no matter what, the gridview always skips the first row returned from my stored procedure.  What am I doing wrong???

comm.CommandText = "123456";
comm.Parameters.AddWithValue("@SubSectionParentID", SubSectionParentID.Text);

reader = comm.ExecuteReader();

                  while (reader.Read())
            gvMenu.DataSource = reader;


populating textboxes via data reader - how do I format the string??


Here is what I have tried:

txtCost.Text = string.Format("{o:c}", dr["Cost"]);

Here is the error I receive.  How can I format the data that is coming from the data reader into currency format???  Also, is there a way to format it into currency without the dollar sign?

Input string was not in a correct format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Input string was not in a correct format.

How to programmatically execute data flow task whose destination is a data reader


Hello everyone

There is a SSIS package containing (among other executables) a data flow task which writes a string to a DataReader Destination. I need to execute just that data flow task and read the string from DataReader Destination programmatically.

I can run the whole package from C# and then read the value. Also the data flow task in question must be embedded in the package.

Does anyone know how to do this?

problem with date range between select Query in data adapter


hi all,

can any one help me out...why am getting "data type mis match error"

 DateTime dFromDate = dt_From.Value;
            dt_From.Value = DateTime.Parse(dFromDate.ToShortDateString());
            string From = dFromDate.ToShortDateString();

            DateTime dToDate = dt_To.Value;
            dt_To.Value = DateTime.Parse(dToDate.ToShortDateString());
            string To = dToDate.ToShortDateString();
            OleDbConnection cn = new OleDbConnection(ConfigurationSettings.AppSettings["connec"]);
            OleDbDataAdapter da = new OleDbDataAdapter("select * from Route_Expenses a where Entry_Date between '" +From+"' and '"+To+"'",cn);
            DataSet ds = new DataSet();
            dataGridView1.DataSource = ds.Tables[0];

 Please..its Urgent!

Unit Testing Error - The unit test adapter failed to connect to the data source or to read the data


I'm using VSTS 2K8 and I've set up a Unit Test Project. In it, I have a test class with a method that does a simple assertion. I'm using an Excel 2007 spreadsheet as my data source.

My test method looks like this:

"Dsn=Excel Files;dbq=|DataDirectory|\\MyTestData.xlsx;defaultdir=C:\\TestData;driverid=1046;maxbuffersize=2048;pagetimeout=5",
public void State_Value_Is_Set()

Difference between Data set and data Reader While accessing huge records from Tables



I have few questions regarding the optimization  issue  .

my application is very slow and i have to optimize the application . One issue is data fetching . Currently to retrieve  data we have data reader  which normally gets the data row by row other approach is to change the data reader and implement the data set which will put all the tables in memory and reduce the disk read and write operations . Please suggest me  which one is the best approach.

Best Regards,



Using Table Adapter in Visual Studio to retrieve data


Hi, I have a profile of member to be displayed. I am using a dataset with all the data table adapter to retrieve the information from database. 

I have a memContact method which has NRIC and Number as a composition primary key. Thus, automatically, the table adapter has created a method called FindByICNum () for me. However, when I do the search to display the contents, i will only need to search by memberic instead. 

Is there anyway to change the table adapter query? 

Parameter for SQL data adapter?


Hi, I've created a SQL data adaptor which returns results to A textbox. There where function is to pull the data from a label Within the page e.g. Select from table1 where Id = @customerid. The customer Id is generated on page load and is output to a hidden label. However I'm currently struggling to get the parameter to Work. It doesn't seem to be connecting to the label. Any help Would be appreciated . Thanks


Code Example Below



<script Language="VB" Option="Explicit" runat="server">

    Protected Sub Page_Load1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim SQLData As New System.Data.SqlClient.SqlConnection("Data Source=********************************************")
        Dim cmdSelect As New System.Data.SqlClient.SqlCommand("SELECT authorfirstname FROM Author WHERE ([AuthorID] = @UserID)", SQLData)
        ' Add parameters and set values.
        cmdSelect.Parameters.Add( _
          "UserID", SqlDbType.NVarChar, 36).Value = LblUserIDValue.Text

        Dim dtrReader As System.Data.SqlClient.SqlDataReader = cmdSelect.ExecuteReader()
        If dtrReader.HasRows Then
            While dtrReader.Read()
                TextBox2.Text = dtrReader("authorfirstname")
            End While

Serialising Data Table returned from Table Adapter Fill method


I am having issues when attempting to serialise a datatable returned from a TableAdapter fill method created via the data set designer.

I have a server executable (which contains the dataset), a client executable and interface referenced by both for proxy purposes.

I guess this is to do with the designer's datatable actually deriving from a datatable (where it adds custom properties and events specific for the data retrieved by the tableadapter).  So I have temporarily made an ugly method of creating a standard new datatable and populating it with column and row data via enumerating the table from the adapter for its column and row data, but I don't want to have to do that!

Standard copy methods on the adapter's table does not work.  Whenever I try to get a datatable via remoting and it references the adapter's table, it returns a serializationerror syaing my server assembly cannot be found (well, only the server knows about these derived datatables so that s understandable).  I don't want to move the dataset into the commonly referenced assembly as that sounds like overkill and probably not good practice?


Binding WPF Controls to an Entity Data Model

In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.

Surrogate vs Natural Primary Keys - Data Modeling Mistake 2 of 10

In case you're new to the series I've compiled a list of ten data modeling mistakes that I see over and over that I'm tackling one by one. I'll be speaking about these topics at the upcoming IASA conference in October, so I'm hoping to generate some discussion to at least confirm I have well founded arguments.

The last post in this series Referential Integrity was probably less controversial than this one. After all, who can argue against enforcing referential integrity? But as obvious as surrogate keys may be to some, there is a good deal of diversity of opinion as evidenced by the fact that people continue to not use them.

Editing the Data in a GridView

In addition to deleting a GridView's underlying data, another common need is to allow end users to edit the data displayed in a GridView. With ASP.NET 1.x's DataGrid control, editing the data is certainly possible, but requires creating three event handlers and writing a dozen or so lines of code. With the GridView and ASP.NET 2.0, it is possible to create an editable GridView without writing a single line of code! All of the necessary functionality is encapsulated within the GridView.

The GridView allows editing on a row-by-row basis. An editable GridView contains an additional column with an Edit button in each row. When the end user clicks on an Edit button that row becomes editable, causing the Edit button to change to Update and Cancel buttons and the other columns to become TextBoxes. The end user can then update one or more column values and click Update to save their changes.

Using ASP.NET 3.5's ListView and DataPager Controls: Displaying Data with the ListView

Prior to ASP.NET 3.5, developers who needed to display a set of records could choose between the GridView, DataList, and Repeater controls. The GridView provides rich data features, but has a very boxy layout; the DataList and Repeater allow for a more flexible layout, but lack the "point and click" data features found in the GridView, DetailsView, and FormView controls. The ListView bridges the gap between layout flexibility and built-in data features.

This article, the first in a series of articles on the ListView and DataPager controls, looks at the ListView's many available templates and illustrates how to display data. Read on to learn more!

Dynamic Data Templates in GridView ASP.NET 3.5

At a high level, Dynamic Data Templates can be seen as a system to very quickly build up a User Interface linked with the relevant data model, immediately enabling you to perform CRUD operations (Create, Read, Update, Delete) on the database using the specified data source. They provide a powerful method for building up these kinds of applications, and I'm going to focus on an overview of what Dynamic Data Templates actually are, and a few ways of customizing them to suit industry needs.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend