|
The act of comparing an object should not change the state of the object*. The act of iterating through two datareaders and comparing the individual values will change the state of the datareader.
* Otherwise well end up with the software development equivalent of the Heisenberg Uncertainty Principle
|
|
|
|
|
i mean that instead of comparing there they can overload == operator
and compare by getvalue method by interating the columns
i think both are doing the same
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
Taken from MSDN
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
yes you can compare values in two datareaders.
|
|
|
|
|
How can we do it.. i have to compare values of two data reders...
One is oledbdatareader and the other one is sqldatareader.wot is the code fro it
i am written the following code:
if( dr.GetValue(0)==dro.GetValue(0)
&& dr.GetValue(1)==dro.GetValue(1)
&& dr.GetValue(2)==dro.GetValue(2)
&& dr.GetValue(3)==dro.GetValue(3)
)
|
|
|
|
|
That will compare the current row in each data reader.
If you want to compare the entire contents you have to take in to account that your comparison process will alter the state of the data reader. Unless you store the data somewhere you'll have to rerun the queries (which may return a different result if you have a database in active use)
|
|
|
|
|
yes i want to compare the current row but itz not working....i have given the code..but the datareaders are of different types.is this making a problem or something else.
|
|
|
|
|
Well, have you checked the values they actually are returning? Perhaps they are different...
|
|
|
|
|
What are the two types that are being returned?
You might try using the following
if (dr1[0].ToString() == dr2[0].ToString())
{do something good here}
By casting both of them to string, you can get a comparison going.
Hogan
|
|
|
|
|
One is sqldatareader that is returning a row from sql and the other is a oledb datareader that is returning the whole recirds in an excel sheet. are they both compatible ...
|
|
|
|
|
Hi.Im using C#..How can I send sms to a mobile phone through C# application..is it possible to sms from c# web application..
Hi,Im Razana
|
|
|
|
|
|
Hope the Article by Manoj Kumar Send SMS[^] here in CP will help you.
Regards,
Satips.
|
|
|
|
|
If you use a SMS Gateway service like Kapoow, you can create an application that will send a HTTP request to the SMS Gateway service for sending SMSs
Freedom is the right to say that 2+2=5 if this is so everything else will follow.
|
|
|
|
|
Hi All,Im a new to our site..Im happy to join you all...Now Im started working with the concept of Ajax..can any help me implement the concept of Ajax when I use text boxes..
Hi,Im Razana
|
|
|
|
|
Hi Razana, Welcome to CP.
First go through the Concepts of Ajax from Here[^].
And then try to implement the Ajax when you use the text box.
Regards,
Satips.
|
|
|
|
|
I need a sample code or tutorial site that teach on how to send email
using Enterprise Library - Logging Block which utilized the exchange server instead of SMTP Server.
I have no problem using a SMTP Server but my company insisted to use Exchange Server. I thought this was a simple task, until i got an error.
|
|
|
|
|
Hi,
could anybody help me? I am trying to run stored procedure on MS SQL 2005. The procedure have one parameter and delete all old records for machine equal to the parameter. I have tried execute it directly in MS SQL Server Management Studio Express and everything was OK. I assign execute rights for the user I used from C# to connect the SQL server but every time I have tried to run the procedure from C# using SQLCommand object I have received the error message in a Output window:
A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
Where could be the problem?
|
|
|
|
|
You should put a try-catch block over the code and catch the SqlException specifically - then you can check the inner-exception. that will tell you what is going wrong.
|
|
|
|
|
Use try/catch block and in catch block see the error message of your exception so that u'll know more about the error.
|
|
|
|
|
I already did it before but it jump to Catch but there was no Message...
I have finally found the problem now, my error. Sorry for pointless question and Thanks for your reactions...
|
|
|
|
|
|
Why are you posting twice? You first post has been answered
|
|
|
|
|
Why did you post again the same question?
I have answered the question below.
Regards,
Satips.
|
|
|
|
|
still i get the same error
|
|
|
|
|
Hi
While building the solution i'm getting this error "error result returned from 'tlbimp.exe'"
Please tell me the solution.
Regards,
Rocky.
|
|
|
|