|
how to search between two data.
|
|
|
|
|
select * from tablename where datecolumn between 'firstdatevalue' and 'seconddatevalue'
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Don't listen to Blue_Boy, he's still in the SQL forum, try
If(a == b)<br />
{TheSame = true}
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
well for starters, if i were you, id take my head out my ass and read a book on SQL
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
Hi Everyone,
Any body have idea how to download the contacts from Hot Mail email id through C#,asp.net.
If there is any API's .please let know.How to use it.
Regards
Subash
Subash
|
|
|
|
|
Try google, seems to be a common enough question
clickety[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi
i am trying to write a method for checking which hosts are alive by connecting to the known application port. but i ran into a very weird thing, connecting to 200 hosts takes me about 10 minutes in my application and not more then 45 sec on a test application with same piece of code.
this are windows applications, the code runs in a separate thread and it's logic is:
int threads = 200;
List<system.net.sockets.tcpclient> clientList = new List<system.net.sockets.tcpclient>(threads);
List<iasyncresult> resultList = new List<iasyncresult>();
for (int i = 0; i < threads; i++)
{
System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient();
IAsyncResult result = null;
try
{
result = client.BeginConnect(testedHost, testedPort, null, null);
}
catch
{
}
clientList.Add(client);
resultList.Add(result);
}
for (int i = 0; i < threads; i++)
{
try
{
clientList[i].EndConnect(resultList[i]);
clientList[i].Close();
}
catch
{
}
}
</iasyncresult></iasyncresult></system.net.sockets.tcpclient></system.net.sockets.tcpclient>
did anyone have problems with BeginConnect/EndConnect, or has any clue why the same block of code could work much slower? in both applications only the main thread and additional thread(where this code runs) are present, no more threads to take the cpu resources.
modified on Thursday, September 18, 2008 2:28 AM
|
|
|
|
|
That is a limitation of the ThreadPool I think. Could also be slow DNS resolution.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
the same code works different in the context of two applications.. don't think the thread pool or DNS has anything to do with that..
|
|
|
|
|
Mark Snow wrote: the same code works different in the context of two applications..
Sorry didnt catch that
So what is the differences between the 2 application instances? Is the input different? Different PC's? Debug/release?
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
same pc, both in debug. input in the same format. in the test application just put random IP's, in the actual application it is loaded from a file that is also generated randomly (same random IPp's).
this thing is driving me mad for a few days now.. i am trying to figure out what could be causing different behaviour. i thought it was the other threads that are blocking it, commented the code that was starting the rest of the threads, nothing changed.
|
|
|
|
|
I am out of ideas
But try this. Add Trace.WriteLine after ever statement, then use a tool like DebugView to see the timings of the calls. That could hint where it is 'lagging'.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
I have values which are numeric and string values. lets say 1,2 ,3 and like xc1,xc2 . I want to sort these values. First sorting numeric ones than none numeric ones. How can I do this with dataview or datatable
I have tried this one...
dataview.sort="column1 ASC";
but its not sorting my data.
Datatype of column1 is string.
Is there any way to use IComparable interface to sort dataview data.
Thanks too much.
|
|
|
|
|
actually the dataview sort DOES sort your column, just not the way you want it to.
Create another column with only the numeric values (assumes you own the datatable) and add it to the sort string
dataview.sort = "Col1, Col2"
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
public static SqlDataAdapter CreateSqlDataAdapter(SqlConnection connection)
{
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
adapter.SelectCommand = new SqlCommand(
"SELECT CustomerID, CompanyName FROM CUSTOMERS", connection);
adapter.InsertCommand = new SqlCommand(
"INSERT INTO Customers (CustomerID, CompanyName) " +
"VALUES (@CustomerID, @CompanyName)", connection);
adapter.UpdateCommand = new SqlCommand(
"UPDATE Customers SET CustomerID = @CustomerID, CompanyName = @CompanyName " +
"WHERE CustomerID = @oldCustomerID", connection);
adapter.DeleteCommand = new SqlCommand(
"DELETE FROM Customers WHERE CustomerID = @CustomerID", connection);
adapter.InsertCommand.Parameters.Add("@CustomerID",
SqlDbType.Char, 5, "CustomerID");
adapter.InsertCommand.Parameters.Add("@CompanyName",
SqlDbType.VarChar, 40, "CompanyName");
adapter.UpdateCommand.Parameters.Add("@CustomerID",
SqlDbType.Char, 5, "CustomerID");
adapter.UpdateCommand.Parameters.Add("@CompanyName",
SqlDbType.VarChar, 40, "CompanyName");
adapter.UpdateCommand.Parameters.Add("@oldCustomerID",
SqlDbType.Char, 5, "CustomerID").SourceVersion = DataRowVersion.Original;
adapter.DeleteCommand.Parameters.Add("@CustomerID",
SqlDbType.Char, 5, "CustomerID").SourceVersion = DataRowVersion.Original;
return adapter;
}
The above function returns adapter of SqlDataAdapter type. Could anyone suggest on how to use it for InsertCommand, UpdateCommand and DeleteCommand in some other place.
|
|
|
|
|
praveen.code999 wrote: how to use it for InsertCommand, UpdateCommand and DeleteCommand in some other place.
Do you want an option to specify the command which has to be created instead of creating all three?
|
|
|
|
|
Hi All,
I am facing very strange problem. I have a Windows form and there are two buttons on it. Each has its click event as shown below:
private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show("Button 2 CLICKED");
}
private void button1_Click(object sender, EventArgs e)
{
button2.Enabled = false;
long = 0;
while (i < 999999999)
{
i++;
}
button2.Enabled = true;
}
on the click of button1, i am disabling button2 and then do some processing (loop) and then enable the button2 again.
Problem is that when i click button1, button2 gets disabled and now i click on disabled button button2, wait till it become enable, at the moment it become enable, its click event gets fired and Message "Buuton 2 Clicked" displayed.
How does C# allow events on disabled buttons?
Please let me know, am i doing something wrong?
Naveen
|
|
|
|
|
Couldn't find much info on this, except that clicks are queued, so when the button becomes enabled, it will fire as many times as it was clicked when disabled. Lame.
One way around it would be to create a 3rd dummy button that's exactly the same as the 2nd button. Then, instead of disabling the second button, hide it and show the 3rd button (disabled). When you're done processing, hide the 3rd button and show the 2nd button again. That way all the clicks will be on the 3rd button, which you can just discard or not even write a handler for.
Did that make sense?
- S
50 cups of coffee and you know it's on!
A post a day, keeps the white coats away!
|
|
|
|
|
Thanks for reply,
But i think this would not work for me as i have to enable/disable so many buttons. I told only 2 buttons just to describe problem.
|
|
|
|
|
When button1 is clicked, you are disabling button2 and starting a long running loop. This loop is running on the main thread where your UI elements are hosted. So it blocks all the messages passed to the window until your loop finishes. The click message is delivering to the window only after loop is finished and button is enabled. It processes the event and you get message. This is how it works.
As a workaround for this, you can run the long running loop on a separate thread. Here is a sample
button2.Enabled = false;
new System.Threading.Thread(delegate(object obj)
{
long i = 0;
while (i < 999999999){
i++;
}
this.Invoke((MethodInvoker)delegate { button2.Enabled = true; });
}).Start();
|
|
|
|
|
Hello,
Please do you know of any C# wrapper for the path functions in shlwapi.dll out there?
I will have to write one, but there is one ready for use, I will not mind.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
I got this[^] from pinvoke.net. is that the one you are looking for?
|
|
|
|
|
Thank you very much, not complete but a good start.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
when i am using NativeMethods, then i am seeing fallowing error : NativeMethods is inaccesible due to its protection lavel.
Am i missing any assambly reference?.
amit
|
|
|
|
|
Where did you find the NativeMethods?
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|