sqldatareader

MySQL Connector/NET connection multiple DataReaders per Connection?

Hey guys, I'm migrating from Java to C# now that I've realized I prefer the C# language features over the ones in Java, but I have this small issue. In MySQL Connector/J and JDBC, I believe that one of my applications allowed multiple PreparedStatements to be executed while another one is open, like I could perform a query that returns a...

ADO.NET Question: When to use DataReader, DataAdapter

Hi guys, i just wondering, what things i have to consider when using DataReader and DataAdapter in fetching data from the database and whats the difference between this two other the datareader needs open connection and the datadapter does not... In our projects, were using DataReader in ALL our DAL, we never use dataadapter. So I wonder...

How do I populate a DataRow using DbDataRecord.GetValues?

Using VB9, I'm trying to populate a DataTable with the results from several stored procedure calls. What I'm trying to make work looks like: For Each record In New SqlCommand("exec getResults", conn).ExecuteReader Dim dr As DataRow = dt.NewRow record.GetValues(dr.ItemArray) dt.Rows.Add(dr) Next It seems like the DataRow.I...

Is there anything faster than SqlDataReader in .NET?

I need to load one column of strings from table on SqlServer into Array in memory using C#. Is there a faster way than open SqlDataReader and loop through it. Table is large and time is critical. EDIT I am trying to build .dll and use it on server for some operations on database. But it is to slow for now. If this is fastest than I have...

How to dispose of a SqlDataReader which is bound to a control

I have an SqlDataReader which I use with a data-bound control. Since I'd like to free the DB-connection as soon as it is no longer used, I'm putting the relevant code into a using-block, e.g. as suggested here: using (SqlDataReader reader = getReader()) { databoundControl.DataSource = reader; databoundControl.DataBind(); } ...

Is SqlDataReader.GetValue query dependant ?

Hi All, In my code I have a Query like this SELECT id,name FROM people I retrieve datas using a sqldatareader. If I change my query for SELECT id,name FROM people WHERE NOT EXISTS( SELECT * FROM people_died WHERE people_died.id = people.id ) I can see with dotTrace that the calls to getvalue takes longer with the second query, so...

Does boolean.ToString() behave differently between .NET 2.0 & .NET 3.5

I've inherited a piece of code at work and I've just noticed a fairly trivial but bizarre little quirk with it. So maybe someone can save me setting up clean .NET 2.0 Environment to test it out. There is a SQL2K5 table containing a column called IsEnabled BIT NOT NULL There is a sproc selecting from that table There is a piece of C# c...

other problem with sqldatareader when the condtion in sql command is arabic

There is a problem with sqldatareader when the condtion in sql command is arabic like this: select user_name from users where typ=N 'arabic text' This does not retrieve any data although there is a user name which has this type so can you help me please ? thank ^_^ ...

ASP.NET Connection Pool Problem?

Hello I create SqlConnection objects in every Insert,Update,Delete and Select methods in asp.net web pages. Then i close the connection objects in finally block. But im not sure about this is a good way. Is this a problem about connection pool? Do you have any recommendations about how to use SqlConnection and SqlDataReader objects for...

two comboboxes in datagridview

i am delaeaing with comboboxes in datagridview in windowsforms assume that i have two combboxes in one datagridview so my question is how to populate comboboxcolumn in datagridview according to selected values from another comboboxcolum in this datagridview ...

SQlDataReader does not update its resultset

Hi, I have a sqldatareader populated with this command: string cmdlookup = String.Format("Select {0} from {1}", strSourceName, strSourceTable); SqlCommand sqlcom = new SqlCommand(cmdlookup, con); SqlDataReader rdrsource = cmd.ExecuteReader(); while (rdrsource.Read()) { this.lstSourceValues....

Retrieving DropDownList 'value' (C#/ASP.NET)

On my page, whenever a DetailsView is updated, I must audit the changes into a database. On most pages this works perfect, as there were just textboxes - however on a page I am working on right now, with dropdownlists, my code isn't working. Basically, what the code does is captures the Updating event of the SqlDataSource, creates a dat...

Read data from SqlDataReader

I have a SQL Server 2008 database and I am working on it in the backend. I am working on asp.net/C# SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { //how do I read strings here???? } I know that the reader has values. My SQL command is to select just 1 column from a table. The column contains str...

Converting SQLDataReader to String in VB.Net

I am returning one row from the database, and I want to convert the SQLDataReader to a string format, so I can pass it to my webservice. Dim rdr As SqlDataReader = sqlcmd.ExecuteReader If rdr.HasRows Then rdr.Read() GetInvHeaderValue = Convert.ToString(rdr.Read()) Return GetInvHeade...

Optimization of SQL Select for enumerators

How can this query be optimized for enumerators: SELECT * FROM Customers Table Customers customerId int - has index on it customerName, etc SqlReader that returns a set customers will be read on-demand in an enumerator fashion. While it can return huge datasets that can be read/consumed slowly in a foreach loop, every other query on ...