|
This is not for anything specific, just been bugging me.
If i have a datareader and execute it to bring back some records (from a SQL 2000 Database), but then before i read them do an update on the table that they have been read from, the rows that i then read do not reflect the changes of the update, therefore the datareader must hold the read in data in memory on a executeReader()
Firstly is it correct that it holds it?
Secondly if it does read some of the data in then does it batch it (because of memory limitations), in my test i was changing the 4th row down in the table, if i was to change say the 20,000th row, would it then reflect the change as it has to go back and read in more data.
Hope this makes sense!! the code is below so you can see what i have done
static void Main(string[] args)
{
try
{
string strConnectionString = ".....";
SqlConnection con1 = new SqlConnection(strConnectionString);
con1.Open();
SqlConnection con2 = new SqlConnection(strConnectionString);
con2.Open();
SqlTransaction trans1 = con1.BeginTransaction();
SqlDataReader dr2;
//READ THE TABLE INTO A READER
SqlCommand mycmd2 = new SqlCommand("SELECT * FROM TABLE1", con2);
dr2 = mycmd2.ExecuteReader(CommandBehavior.CloseConnection);
//CHANGE A ROW IN THE TABLE
SqlCommand mycmd1 = new SqlCommand("UPDATE TABLE1 SET Bla = Bla where ID = Bla", con1);
Console.WriteLine(mycmd1.ExecuteNonQuery().ToString());
//LOOP THROUGH THE DATAREADER OUTPUTTING THE CONTENTS (DOES NOT REFLECT THE ABOVE UPDATE)
while (dr2.Read())
{
//write out the 'data' field
Console.WriteLine(dr2.GetInt32(1).ToString());
}
dr2.Close();
con1.Close();
con2.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
|
|
|
|
|
That would depend, at least in part, on the transaction's IsolationLevel.
|
|
|
|
|
Thanks, now i have looked into that i understand what is going on
|
|
|
|
|
I have a solution in C# which has 6 projects Say
A, B, C, X, Y, Z
Where A, B, C generates exe's and X, Y, Z is of type Class library (DLL)
1) Executables A and B both hold a reference to Projects X, Y, Z (dll).
2) Where Executable C holds a reference to Dll X only.
X,Y,Z are private assemblies and not candidates for GAC.
Now since they are private assemblies when I add a reference it'll be copied to the project output directory locally. And if I'll set the property "Copy Local = false" then it'll not get copied and the exe's fails when.
What I wanna impose is a directory structure for my solution to avoid multiple copies of dll's when deploying.
LetSay it'll copy all the files in...
\AppRoot
......... A.exe
......... B.exe
......... C.exe
\AppRoot\Lib
.............. X.dll
.............. Y.dll
.............. Z.dll
And have them work correctly. I'm new to Dotnet and perhaps to programming.. Please help how to impose this kind of directory structure for my app.
Thanks.
SMK
|
|
|
|
|
Create a common folder for the output from the class library projects and change the project settings for these. Then have your exe project reference the assemblies from this location.
AppRoot
Common
Lib
x
y
z
only two letters away from being an asset
|
|
|
|
|
The deployed structure need not echo the development structure.
Add a deployment project.
|
|
|
|
|
True, however creating a common folder for this senerio will ease creating a deployment package
only two letters away from being an asset
|
|
|
|
|
Create a common folder....
Where... do you mean solution folder or a folder in each project?
Change the project settings for these...
How... you mean using Project Properties>> Built>>> Output Path??
Do I have to use an absolute or relative path to Common??
Please need a little more clarification on this.
SMK
|
|
|
|
|
Common to the solution. The reference can be either relative or absolute, although I believe VS converts it to relative if it can.
only two letters away from being an asset
|
|
|
|
|
Hi,
I have a rich text box names "Rtb" with the text "font". when i try to replace the text "font" with some other text, say "Text" using the below code,
Rtb.Rtf = Rtb.Rtf.Replace("font", "Text");
the replaced text comes like "Microsoft Sans Serif;Text" rather than "Text".
Any idea why it is behaving like this and a solution to fix this is welcome.
|
|
|
|
|
Because you are treating the formatted text as if it was just text. Your replacement conflicts with the formatting in the string. What you see is broken formatting spilling into the text.
---
Year happy = new Year(2007);
|
|
|
|
|
Hi,
Thanks for the reply.
I am doing that to maintain the format of the replaced text. Is there any other way to do the same?
|
|
|
|
|
how can i reboot my pc with c code ?
|
|
|
|
|
|
Right message board, please
SkyWalker
|
|
|
|
|
Hi,
How is it possible to send a pdf document to a fax machine using C# ?
Regardless of what fax machine it is, is there a way with .NET to implement
code to send to a fax machine ?
I've generated pdf docs using iTextSharp and want to send those to a faxnumber.
We have a FaxTalk Communicate software at the job and it would be nice to use it.
Need some guidance, plz
Daniel from Sweden
|
|
|
|
|
|
Well,
this looks like something used thru the web ?
Okey, i'll put it like this.
I have pdf docs.
I have a Brother MFC-9070 printer/fax.
I have my C# code.
How can i send this pdf doc to this printer/fax so it sends it to a given number ?
Is it possible to send a pdf doc directly to this printer since pdf docs
contain formatting and stuff. Must it not be converted to an image and then be
sent away?
Looked at C# system commands, if it were possible to start a pdf reader with a pdf doc, print it out and then take the paper and manually send the fax.
But i want to avoid this step.
would like someone to shine some light, i'm not familiar with programming against hardware, seriell ports and so on..
Thanks, Daniel from Sweden
|
|
|
|
|
Hi,
I recently found a great tutorial on scripting an application. I can run scripts from within the application. But what if I want to have an external application run scripts in my main application. How would I go about doing so?
|
|
|
|
|
Make sure you are using using System.Diagnostics , then:
Process p = Process.Start("CScript.exe", "YourCsript.vbs"); (or whatever other script - make sure the specify the correct path to it)
SkyWalker
|
|
|
|
|
I'm not sure I posed the question correctly. Thanks for your reply.
I used this tutorial http://www.developerfusion.co.uk/show/4675/
I'm new to this programming thing. I want to be able to access my running program and send it a script and have it compile and run it. I want to do this all from a totally separate application.
|
|
|
|
|
|
How to enable Promiscuous Mode using c#.
thnks in advance
Lxcite's Planet
... the ultimate solution
|
|
|
|
|
Hari Om Prakash Sharma wrote: Promiscuous Mode
What's that?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|