|
Yes, that is how I tested them to get the bugs out (On My Machine). It takes a good 2 days or so before they stop accepting connections, however, and debugging for that long really isnt feasible, because it doesnt always happen. It does report errors, but the error logs dont report anything unusual, client connected/disconnected, updating database, etc. Nothing that should clog the server like that. Thanks...
Aaron
|
|
|
|
|
How are you running this? Windows service? ASP.NET? Windows app? Command line? Different/same PC?
Maybe the hardware is going into power saving mode...
|
|
|
|
|
I created a tabbed app that has a number of checkboxes on the second tab. I'm using currency manager to keep track of the number of records that are currently in the DB as well as adding, deleting records. I also am using data view to sort my records based on what the end user is looking for.
When I go to add a new record and click on the second tab, I get a DBNull exception.
I've made sure that the fields in the database are set to not allow nulls, and with a default value of zero.
I want to do a check to make sure that if the field is null then the binded field = false?
Or is there a better way to do this?
Thanks
Tom Wright
tawright915@yahoo.com
-- modified at 15:13 Wednesday 12th April, 2006
|
|
|
|
|
To Check if a field's value is null:
dataset.tables[0].row[0]["Field_Name"] == DBNull.Value
Was it a cat I saw?
|
|
|
|
|
Thanks but I ended up fixing my problem this way.
Right before I add a new record I set the default value of the columns
ds.Tables[0].Columns["FieldName"].DefaultValue = false;
This seems to have done the trick.
Now I'm having problems saving mulitpule times on the same record.
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
when i try to make new class or project this error appear: "Automation server can't create object" . i try to reinstall VS2003 but this is not a solution for me..this is the error.
"Automation server can't create object"
i searced the messages but cant find anything about this..
thakns for now..
hasan tayyar
|
|
|
|
|
how create a toolbar that is active when the main window is active then deactive when the main is so too?
p.s. i want it will be conform to windows xp and vista.
tnx
|
|
|
|
|
Please help this. There are 2 errors at Thread creation.
I'd like to pass ArrayList to thread.
using System;<br />
using System.Threading;<br />
using System.Collections;<br />
namespace ConsoleApplication2<br />
{<br />
class Program<br />
<br />
{<br />
static object lockObject;<br />
<br />
static void Main(string[] args)<br />
<br />
{ <br />
<br />
<br />
ArrayList space = new ArrayList(); <br />
<br />
for (int i = 1; i <= 10 ; i++)<br />
{<br />
space.Add(i);<br />
<br />
} <br />
<br />
lockObject = new object(); <br />
<br />
<br />
Thread t1 = new Thread(new ParameterisedThreadStart(AccessData)); t1.Start(space);<br />
<br />
Thread.Sleep(20*1000);<br />
<br />
}<br />
<br />
<br />
<br />
public static void AccessData(object param)<br />
{<br />
<br />
ArrayList list = (ArrayList)param;<br />
<br />
lock (lockObject)<br />
{<br />
Random rand = new Random();<br />
<br />
int x = rand.Next(list.Count);<br />
list.Remove(x);<br />
Console.WriteLine("x = " + x);<br />
<br />
int y = rand.Next(list.Count);<br />
list.Remove(y);<br />
Console.WriteLine("y = " + y);<br />
<br />
int newNumber = x + y;<br />
Console.WriteLine("newNumber = " + newNumber);<br />
<br />
list.Add(newNumber);<br />
<br />
<br />
<br />
foreach (int inte in list)<br />
Console.WriteLine(inte);<br />
<br />
}<br />
<br />
<br />
<br />
}<br />
<br />
}<br />
}<br />
eric
|
|
|
|
|
What are the 2 errors?
Which version of the .NET framework are you running? (ParameterizedThreadStart is only in version 2.0 or higher)
|
|
|
|
|
Ah
The type or namespace name ParameterisedThreadStart could not be found
I use 1.1
So how I can get rid of that.
Please help
eric
|
|
|
|
|
get VS05 and use the 2.0 framework or find the 1.1 equivilant to the code.
|
|
|
|
|
Well, I just got the same errors in VS.Net 2005
So it's not because of the framework version then
Please help
eric
|
|
|
|
|
Make sure you've got
using System.Threading;
at the top of your .cs file where you use ParameterizedThreadStart.
You can read more about it here[^].
There are several alternatives though, including some that work on all .NET versions. Here's another way of starting a new thread, using Delegate.BeginInvoke:
public class MyClass
{
public delegate void FunctionThatTakesAnArrayList(ArrayList argument);
...
void StartTheThread()
{
FunctionThatTakesAnArrayList function = ThreadedArrayListUsage;
function.BeginInvoke(myArrayList, null, null);
}
void ThreadedArrayListUsage(ArrayList list)
{
}
}
Here's another way, using the .NET thread pool:
void StartTheThread()
{
System.Threading.ThreadPool.QueueUserWorkItem(ThreadedArrayListUsage, myArrayList);
}
void ThreadedArrayListUsage(object state)
{
ArrayList list = (ArrayList)state;
}
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: I luv teh choco
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Thanks so much
I'm doing now
eric
|
|
|
|
|
Hi:
I selected Tooltip from the toolbox and clicked on the form and then for the contriols I want a tooltip, I went to the properties and entered the text I want to show (I tried with an without double quotes).
But I cant get the tooltip to show up. Please could you tell me if I am missing doing something?
Thanks, smurfy
|
|
|
|
|
Hey Smurfy,
Are you talking about Windows or Web application?
Manas
|
|
|
|
|
Hi Manas:
this is for a windows application.
Thanks, smurfy
|
|
|
|
|
I've had various issues with tooltips before as well. What I've found is that if I don't set the tooltip text at form load then the tooltip will never show up. I've often found that I have to set generic text and then set the tooltip active property to false until sometime later in my code I set the text I need and mark the tooltip active again. Using this method works every time. Maybe a bug in c# but i'm not sure.
Oh, and if you need the tooltip to show up even if the control it's bound to isn't the active control of the form then set it's show always property to true.
|
|
|
|
|
thank you I will try that out.
Regards, smurfy
|
|
|
|
|
Please help me
How can I call pass the ArrayList to 2 threads as parameter, and Synchronization thread
This is my code. My coding is not good, please help me
static object lockObject;
static void Main(string[] args)
{
ArrayList space = new ArrayList();
for (int i = 1; i <= 10 ; i++)
{
space.Add(i);
}
lockObject = new object();
lock (lockObject)
{
Thread t1 = new Thread(new ThreadStart(AccessData));
t1.Start();
}
lock (lockObject)
{
Thread t2 = new Thread(new ThreadStart(AccessData));
t2.Start();
}
Thread.Sleep(20*1000);
}
public static void AccessData(ArrayList arr)
{
// Thread.CurrentThread.IsBackground = true;
Random rand = new Random();
int x = rand.Next(space.Count);
space.Remove(x);
Console.WriteLine("x = " + x);
int y = rand.Next(space.Count);
space.Remove(y);
Console.WriteLine("y = " + y);
int newNumber = x + y;
Console.WriteLine("newNumber = " + newNumber);
space.Add(newNumber);
foreach (int inte in space)
Console.WriteLine(inte);
}
eric
|
|
|
|
|
1. Locks are meant to be used inside the threaded code, not outside where you begin the thread. (In other words, use locks inside your AccessData method, not where you start the thread.)
2. You can start a thread with a parameter using something like this:
ParameterizedThreadStart threadStart = MyFunction;
Thread myThread = new Thread(threadStart);
myThread.Start(myArrayList);
...
void MyFunction(object parameter)
{
ArrayList list = (ArrayList)parameter;
}
3. Next time, use the <pre> tag around the code you post on this forum to preserve formatting.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: I luv teh choco
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Please help this. There are 2 errors down
using System;<br />
using System.Threading;<br />
using System.Collections;<br />
namespace ConsoleApplication2<br />
{<br />
class Program<br />
<br />
{<br />
static object lockObject;<br />
<br />
static void Main(string[] args)<br />
<br />
{ <br />
<br />
<br />
ArrayList space = new ArrayList(); <br />
<br />
for (int i = 1; i <= 10 ; i++)<br />
{<br />
space.Add(i);<br />
<br />
} <br />
<br />
lockObject = new object(); <br />
<br />
<br />
<br />
Thread.Sleep(20*1000);<br />
<br />
}<br />
<br />
<br />
<br />
public static void AccessData(object param)<br />
{<br />
<br />
ArrayList list = (ArrayList)param;<br />
<br />
lock (lockObject)<br />
{<br />
Random rand = new Random();<br />
<br />
int x = rand.Next(list.Count);<br />
list.Remove(x);<br />
Console.WriteLine("x = " + x);<br />
<br />
int y = rand.Next(list.Count);<br />
list.Remove(y);<br />
Console.WriteLine("y = " + y);<br />
<br />
int newNumber = x + y;<br />
Console.WriteLine("newNumber = " + newNumber);<br />
<br />
list.Add(newNumber);<br />
<br />
<br />
<br />
foreach (int inte in list)<br />
Console.WriteLine(inte);<br />
<br />
}<br />
<br />
<br />
<br />
}<br />
<br />
}<br />
}<br />
eric
|
|
|
|
|
eric_tran wrote: Please help this. There are 2 errors down
Please clarify. I don't know what you mean by "2 errors down".
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: I luv teh choco
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Sorry Judah
There are 2 errors at the Thread Creation and Start lines
Please help
eric
|
|
|
|
|
I'm replying to your other post above.
|
|
|
|