|
Try NumericUpDown instead.
|
|
|
|
|
Could someone clarify a question i have about the code snippet shown below, i know when the useing block ends the OleDbConnection's Dispose method is called, but what i'm not clear on, is the OleDbDataAdapter's Dispose method called also as it is inside the using statement or must I Call it my self? Any information wuold be appreciated.
using (OleDbConnection connection = new OleDbConnection(_connectString))
{
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.SelectCommand = new OleDbCommand(_selectCmdText, connection);
// additional processing
}
Thank you in advance.
William T
|
|
|
|
|
I'm pretty sure (unless someone wants to correct me) that everything will dispose of itself accordingly. If you have any connections open though, I'd recommend closing them before everything is thrown through the garbage collector.
Cheers,
|
|
|
|
|
Nope, the adapter.Dispose() will not be called.
The
using (OleDbConnection connection = new OleDbConnection(_connectString))<br />
{<br />
}
is equivalent to
<br />
OleDbConnection connection = new OleDbConnection(_connectString);<br />
try<br />
{<br />
}<br />
finally <br />
{ <br />
connection.Dispose(); <br />
}
If you want to dispose the adapter you must wrap it inside a using, something like this:
<br />
using (OleDbConnection connection = new OleDbConnection(_connectString))<br />
using (OleDbDataAdapter adapter = new OleDbDataAdapter())<br />
{<br />
}<br />
|
|
|
|
|
Hi
I have created a Trigger Statement and assigned to CommandText property of
sqlCommand.While Try to Execute using
command.ExecuteNonQuery() it throws an exception like
{"Incorrect syntax near the keyword 'TRIGGER'."}
Created Trigger Statement:
CREATE TRIGGER SampleTrigger
ON dbo.sample
AFTER INSERT
AS begin
SET NOCOUNT ON
DECLARE @Name AS nvarchar(50)
SELECT @Name= i.Name from inserted i
DECLARE @Address AS nvarchar(50)
SELECT @Address= i.Address from inserted i
insert into triggertest(statusID,FieldName,FieldValue) values( 25,'Name',@Name)
insert into triggertest(statusID,FieldName,FieldValue) values( 25,'Address',@Address)
end
Can anyone help me?
Thanks in advance
Sri
|
|
|
|
|
I don't see anything wrong with it.
You should ask SQL questions in the SQL forum.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I am trying to use SocketOptionName.BlockSource which is a poorly documented socket option. How do I use this option and does it block all packets from an address like I think it does?
I would think that this should work
IPAddress TestIP = IPAddress.Parse("127.0.0.1");
ClassSocK.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.BlockSource, TestIP);
but it does not. I get the fallowing error
"The specified value is not valid.
Parameter name: optionValue"
|
|
|
|
|
Hi!
How can i find out the name of function which is under execution. For example, please see the following code:
void TestFunction()
{
String currentFunctionName = "TestFunction";
}
In the above code, i've hardcoded the name of function in variable currentFunctionName. I want to do that programatically. Please tell me how can i do so. Back during the days of C+, i use __FUNCTION__, please tell me how can i do this is C#. Is it an area of reflection ?
Imtiaz
|
|
|
|
|
StackTrace st = new StackTrace();
string methodName = st.GetFrame(0).GetMethod().Name;
I'm largely language agnostic
After a while they all bug me
|
|
|
|
|
string currentMethod = MethodInfo.GetCurrentMethod().Name;
|
|
|
|
|
i m trying to insert byte[] in a file but FileStream and BinaryReader replaces the byte[], for example i want to insert byte[] at 3000 offset, so i tried to write like this :
byte[] tmp_byte = new byte[10]
FileStream fs = new FileStream("C:\\abc.kk", FileMode.Open);
fs.Seek(3000, SeekOrigin.Begin);
fs.Write(tmp_byte);
this code replaces the previous byte[] with new one, but i want to insert... how can i do this ?
thanks
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
You'd have to write the first 3000 bytes to a new stream, then write yout byte[], then write the rest of the data to the new stream. Then you write this whole stream back to the file.
I don't think there's a better way to do it either.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
damn my data is in gbs, it will take lots of time
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi!
This is what i have so far...
foreach (string result in Ldap.Query(filtertext))
{
ThreadStart starter = delegate { NetInfo.Resolve(result, out ipResult); };
Thread t = new Thread(starter);
t.Start();
while (t.ThreadState.ToString() == "Running")
{
Thread.Sleep(50);
}
}
The problem in my mind is that i'm making the UI thread sleep... this ties up the UI and seeing as how i started trying to integrate multi-threading to stop something like this and increase the speed at which i can ping other machine's and return there address assuming they are up. What should i do because i need alot of the values off the UI and i'd still like to not tie up the UI i've been reading a bit about using a threadpool i'm not sure if that would be faster or not... The other problem that i'm running into is that i have to pull a bunch of values off the form and then obviously i need to put other values back on the form in a listview. I was thinking that i could start a new thread that starts all the threads that pulls all the values back and then stores them into something like a arraylist and pushes the values back to the form... is this a good idea? or should i just forget about multi threading? I hope this isn't to muddled up and is clear enough for people to understand if you need further clarification lemme know...
I know the human being and fish can coexist peacefully. -George Dubya Bush
Don't believe me?
http://politicalhumor.about.com/library/blbushism-fish.htm
Yes thats right he actually said that...
|
|
|
|
|
I agree that "Thread.Sleep(50);" is sleeping the UI thread.
Bad thing to do, generally speaking.
You might want to change the
while(t.ThreadState.ToString() == "Running"){}
into
while(t.ThreadState == ThreadState.Running){}
Strings are slower, and string compare should be done using
String.Compare(string a, string b) , not a == b , which does not compare the string content.
There are a number of mechanisms for sharing data between the UI and other threads. A simple one is to have the thread Invoke a call on the form. This will allow the other thread to pass data back to the form with out UI sync problems.
You also need to pass the initial data in to the thread you are starting.
Generally, I create a class that has the threaded method, and holds the data (or references) that are needed. The UI thread creates objects of that class, hands them the data, and tells them to go start themselves. That way you just start them,and don't have to wait for any type of sync events before you start the next.
LMK if that helps.
Learn to write self marginalizing code!
Call 1-888-BAD-CODE
------------------
Silver member by constant and unflinching longevity.
|
|
|
|
|
Hi,
For more responsive UI in case of multithreading, think about BackgroundWorker class.
The class is providing options to intimate the UI about the progress of the thread and thread completion status.
Please lemme know if it works.
|
|
|
|
|
I am using DataTable/DataSet and a dynamic GridView.
I want to display a check mark that can not be an image because of the column (datatable) datatype restrictions. So, I was trying to use ASCII value. For check mark, the decimal ASCII value is 251. But it gives me something that doesn't look like a check mark at all.
Any ideas?
Thanks.
Ekjon
|
|
|
|
|
I actually found the way. Never mind.
|
|
|
|
|
|
it's possible to create one, yes.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
|
Buy a book. And tell your "instructor" to do the same. He's really not much better than you.
Also realize that he's "teaching" because he couldn't get a real job anywhere. He's a misfit. And you're asking for help, as a misfit, to satisfy yet another misfit. Very sad.
|
|
|
|
|
This person wants us to do his homework. Ignore!
|
|
|
|
|
|
Do you mean generics?
search for "c# generics"[^]
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|