ADO.NET :: Difference Between ExecuteDataSet And ExecuteReader?
Feb 21, 2011What is the difference between ExecuteDataSet and ExecuteReader.
View 2 RepliesWhat is the difference between ExecuteDataSet and ExecuteReader.
View 2 Replieswhat is the exact difference between Sqlhelper.ExecuteReader and Sqlhelper.ExecuteXmlReaderand which on is faster
View 3 RepliesI am trying to complete my function below but got lost in the different methods out there. It will always return 1 row and I need to get the values of the record and ADD into a new row. The function returns a DataTable.
[Code]....
protected void Button1_Click(object sender, EventArgs e)
{
SqlCommand cmd;
[code]...
I am getting error that ExecuteReader: Connection property has not been initialized
I'm using data access block [URL] in asp.net 3.5. Back end is sql server 2005. It's working fine and returns result instantly for all DB calls. But, I've a problem with one SP. When I call it, executereader is taking too much time. In few cases, it is executed. And sometimes I get the Time out error. I run the same SP in sql server. It returns 9000 rows in 3 seconds.
View 3 RepliesDim reader As SqlDataReader
reader = cmd.ExecuteReader
Dim XML As String = reader("records").ToString
I've executed the command in SQL server and I get a result string with length of 54781But when I execute it via .NET and assign it to the XML variable, the length of XML is always 2033...so now Im thinking that the result column "records" cannot exceed this length for some reason...
here my code-
using (SqlDataReader sqlDataReader = ExecuteReader(CommandType.StoredProcedure, StoredProcedures.AuthenticateUser, sqlParameter))
{
isAuthenticated = Convert.ToBoolean(sqlParameter[2].Value);
if (isAuthenticated)
{
if (sqlDataReader.Read())
{
User = new UserEntity();
DbHelper.GetEntity(sqlDataReader, User);
}
}
}
I always get isAuthenticated as false because sqlParameter[2].Value is null all the time but when I execute my query with ExecuteNonQuery it gives me the value but in that case I can not fill the entity.
After trying many solutions listed on the internet I am very confused now. I have a C#/SQL web application for which I am simply trying to bind an ExecuteReader command to a Dropdownlist so the user can select a value. This is a VS2008 project on an XP OS.
How it works is after the user selects a table, I use this selection as an input parameter to a method from my Datamatch.aspx.cs file. Then this Datamatch.aspx.cs file calls a method from my ADONET.cs class file. Finally this method executes a SQL procedure to return the list of columns from that table. (These are all tables in Adventureworks DB). I know that this method returns successfully the list of columns if I execute this SP in SSMS. However, I'm not sure how to tell if it works in VS or not.This should be simple. How can I do this? Here is some of my code. The T-sQL stored proc:
CREATE PROCEDURE [dbo].[getColumnNames]
@TableName VarChar(50) AS
BEGIN
SET NOCOUNT ON;
[code]...
The CreateLabels method above correctly shows me the labels. But the CreateDropDownLists method just shows me one dropdownlist with nothing in it. In other words, it is not selectable. So how can I verify that the datareader is returning all 4 columns and inspect their values? I was able to find from datareader "COLUMN_NAME" but I don't know what properties to search to verify the column names.
I am having problems with the following. On debugging I find that when strKeywords = '', reader = "System.Data.SqlClient.SqlDataReader". However, as soon as strKeywords takes the value of anything else, reader = nothing. But the stored procedure handles the arguments fine, so I am very confused!
[Code]....
Some time i getting error below ,but i am did'nt used excutereader
ExecuteReader requires an open and available Connection. The connection's current state is closed.
This my code,
try { if (con.State != ConnectionState.Open) con.Open(); string result;
string Queryip = "ViewIp"; SqlCommand cmdip = new SqlCommand("ViewTranscation", con);
cmdip.CommandType = CommandType.StoredProcedure; cmdip.Parameters.AddWithValue("@QueryType", Queryip); cmdip.Parameters.AddWithValue("@Input1", "");
[Code] ....
Note: You may not need to read the whole thing to know what's wrong... skip down to the part about the 3 scenarios if you'd like. Only read the begin if you'd like some background info on how I've tried implementing this and where the errors occurred.To begin with, I'm trying to retrieve a list of Clients stored in the CRM_Clients table for a given callerId.I retrieve the clients from my Controller with the SelectLiveClientsForCaller method. The message is then passed on to the DAL through the static Instance method in the DataProvider class:
public List<Client> SelectLiveClientsForCaller(int callerID)
{
List<Client> results = new List<Client>();
[code]...
Im trying to take the example from this website http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/sql-server-2008-proximity-search-with-th and make it work on my site. Its this part im having troubles with
[Code]...
here is my code from my function that doesnt work.
[Code]...
Any suggestions on how to get it to work? it fails at rdr = cmd.ExecuteReader(); im also worried it will also fail at ZipCodes.Add(rdr["h.*"].ToString());
I would like to know about the difference between .DLL and .EXE?
View 1 RepliesI thought that <%: had replaced <%=, since mentions on [URL]Prior to ASP.NET 4, the <%= %> syntax was used to execute code and write it out to the page. Starting with ASP.NET 4, you should always use the <%: %> syntax instead..."
However, I've noticed that
<img src='<%=ResolveUrl("~/Images/MyImage.jpg")%>' alt="blah">
works, whereas
<img src='<%: ResolveUrl("~/images/MyImage.jpg")%>' alt="blah">
doesn't.
I'm not sure what the name for these types of expressions are so I've had trouble googling it.
what is the difference between the 1.0,2.0 and 3.5
View 6 RepliesWhat is the difference between L2S (Linq to SQL) and EF (Entity Framework), much appreciated if you highlight the cons and pros?
View 6 RepliesPossible Duplicate:
ASP.NET “special” tags
I hope this isn't too much of a newbie question. I seem to always use the correct syntax, but I don't really understand why I'm using the <%: and <%= in ASP.NET, and I was hoping someone could clarify for me. I found this article which explains <%= and <%#, but wasn't able to find anything in Google on <%:.
Examples of where I have used the various syntax:
<div>
<%: Html.LabelFor(model => model.Type) %>
<%: Html.TextBoxFor(model => model.Type)%>
</div>
and
<div id="header-menu">
<ul>
<li><%= Html.ActionLink("Home", "", "Home" )%></li>
</ul>
</div>
Possible Answer (per ChrisF): ASP.NET "special" tags
Are asp and c# completely different things or ..?
Is asp a language or asp.net? Are c, c++, c# languages?
What is a framework, stack, language
What is the difference between c#.net and vb.net ?
I faced this question in an interview. Any technical difference is there ? I heard that there are two methods additional in vb.net which are not there in vb.net.
What is the differnce between MVC and MVP. for asp.net application which bettor one to use.
View 4 RepliesI am in the process of learning MVC, and thought I would parallel the work in both C# and VB.NET. I ran into a snag when right-clicking in an action method inside of a controller to add a view - in C# if I choose to strongly type the view it includes all the objects in the models folder in the drop-down list for selection; however, in VB.NET none of the models are available in the list. Is there some step I need to take in order to make the models objects available in the drop down for selection?
View 4 RepliesI want to know the difference between IIS 7.5 and Web(PI)3.0?
View 5 Repliesthe difference between MVC and AJAX ? What elements should be considered by me when choosing one of them for system development ?
View 3 RepliesI'm starting to learn ASP.NET and going through the tutorial videos on www.asp.net. I understand the basic concept of web application frame works like ASP/PHP/ASP.NET. HTML/XHTML is created with special tags that the server knows to read and replace with content. I did a little bit with ASP during a summer internship back in the 90's.
Yet with the few examples of ASP.NET I've seen so far it seems ASP.NET has two types of server interpreted tags.
Most of the time I see <asp:XXXX > tags such as
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
but I also see regular ASP tags like
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="TailspinSpyWorks.SiteMaster" %>
What is the difference between these two tag formats? Both are interpreted by the server correct? Why would I use one over the other?
Have a C# application. When I look in the project folder I see an .exe in bin/debug folder, when I click it executes the application fine. I also see the same .exe in obj/debug folder, when I click it executes but gives me error. What is the difference between these 2 objects and why do I have 2 of them?
View 4 Replies