Questions tagged [sqldatareader]

Provides a way of reading a forward-only stream of rows from a SQL Server database.

The SqlDataReader is a member of the .NET framework's System.Data.SqlClient family responsible for reading data from a SQL database. The SqlDataReader is created by calling the ExecuteReader() method of the SqlCommand object, instead of directly using a constructor.

While the SqlDataReader is being used, the associated SqlConnection is busy serving the SqlDataReader, and no other operations can be performed on the SqlConnection other than closing it. This is the case until the Close method of the SqlDataReader is called. For example, you cannot retrieve output parameters until after you call Close.

Changes made to a result set by another process or thread while data is being read may be visible to the user of the SqlDataReader. However, the precise behavior is timing dependent.

For optimal performance, SqlDataReader avoids creating unnecessary objects or making unnecessary copies of data. Therefore, multiple calls to methods such as GetValue return a reference to the same object. Use caution if you are modifying the underlying value of the objects returned by methods such as GetValue.

References

MSDN Article

1132 questions
-3
votes
4 answers

C# Index of for space and next informations

Please, can you help me please. I have complete select adress from DB but this adress contains adress and house number but i need separately adress and house number. I created two list for this distribution. while (reader_org.Read()) …
user2813962
  • 3
  • 1
  • 1
  • 4
-3
votes
2 answers

Which one will run faster?

Possible Duplicate: Is datareader quicker than dataset when populating a datatable? public DataTable GetReviewsId(Objects myObjects) { DataTable tblBindReviews = new DataTable(); string Query = ""; try { Query =…
Niar
  • 532
  • 2
  • 11
  • 23
-4
votes
1 answer

sqldatareader with login(Invalid object name Role)

private void button2_Click(object sender, EventArgs e){ sqlCon.Open(); String Name = textBox1.Text; String password=textBox2.Text; SqlCommand check = new SqlCommand("SELECT r.RoleName FROM Role r WHERE RoleID ID(SELECT s.RoleID FROM…
Tariq
  • 1
-4
votes
1 answer

C # problems with SqlDataReader

I came across the following error, can anyone help me ?
-4
votes
3 answers

c# data reader change field name before Binding

I have SqlDataReader that fill with ExecuteDataReader statement. I want to change some column name in DataReader after fill. for example after fill datareader i have two column (A,B) i want to change colum 'A' to 'a'(convert to lowercase)befor…
abianari
  • 343
  • 7
  • 19
-5
votes
4 answers

C# SQL Query and apostrophe's

Possible Duplicate: SqlDataReader parameter not working I am trying to get a pc name from a textbox to a sql parameter in a windows form application. It works fine when I input the parameter like the following. string query =…
user1836162
  • 59
  • 2
  • 4
  • 14
-6
votes
1 answer

C# connect to MySQL and read data

So I have this website that people can shop online, but I want to make a software that will read the MySQL database for new orders and when a new order is placed, the software should display the order in some sort of a list. I am using wordpress for…
1 2 3
75
76