|
You're storing dates as strings in the ShortTimeString format ? That's a time, not a date. And, it's an inefficient way to store them. And it's redundant - you ask for only for values with a specific time, and then you check to make sure your database is not lying to you ?
I don't see a question here - what is the problem ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Dear programers
i hav application having forms
when user press f1 respective form displayed from .chm file.
i have used Help.ShowHelp(this,filepath,keyword)
i want to add a feature if user press F1 on button then in form the selected topic should be highligted
how can i do it
i will appriciate ur comments
sikandar
|
|
|
|
|
hi Guys,
i have to send xml files via MSMQ. I am very new to this.
Can anyone guide me for this?
---------------
I dynamically create XML file and try to save it on share folders and as well as try to send to destination server via MSMQ. XML file is generating without any error.
-----------------------------------------------
I have given the code what i have written (code in C#.net 2003). It's not giving me any error, but as well as not sending file also.(transfer would be one server to other server. and both server is in different domain. I can access destination server from source server- Ping servername)
string QueuePath = @"FormatName:DIRECT=OS:server \private$\DEVqueSERVICE";
MessageQueue queueA = new MessageQueue(QueuePath);
file = new FileStream(fullName,FileMode.Open,FileAccess.Read,FileShare.Read);
XmlTextReader xtr = new XmlTextReader(file);
System.Messaging.Message msg = new System.Messaging.Message();
msg.Label=getcounter();
StreamWriter wr = new StreamWriter(msg.BodyStream,System.Text.Encoding.Unicode);
wr.Write(file);
wr.Flush();
try
{
queueA.Send(msg, MessageQueueTransactionType.Single);
}
catch
{
}
finally
{
queueA.Close();
}
|
|
|
|
|
Hello,
Is it possible to format an USB Stick (drive) with an ManagementObject or something else?
Thanks for help!
Martin
|
|
|
|
|
Salam
we have a public static variable lets say temp in a class lets say A and another class lets say B creates a thread that will update temp's value after every 10 seconds by getting values from Data base.And another thread of the same class uses updated values of temp.Now the problem is this that ,
we are not getting updated values of temp in the second thread of the classB.can any body figure out the problem in this scenario.
plz I need an urgent reply.
thanks
|
|
|
|
|
Use lock when you access the variable, or declare it as volatile .
samtam wrote: I need an urgent reply.
Are you sure that the reply should be urgent, or is it perhaps that it is needed urgently?
---
b { font-weight: normal; }
|
|
|
|
|
Thanks,
But we have already used Monitor.Enter and Monitor.Exit methods for locking mechanism, but it doesnt work.
So now???????????
Urgent Reply is needed urgently!!!!!!!!!!!
|
|
|
|
|
That should do it. Are you using it both when reading and writing the value? Are you locking on the same object?
---
b { font-weight: normal; }
|
|
|
|
|
Ofcourse we are locking the same object and using it both reading and writing times. we used Monitor.TryEnter at the time of reading that object. which provides exclusive lock.
|
|
|
|
|
If you have done it right, then it works. So the conclusion is...?
What does the code look like?
---
b { font-weight: normal; }
|
|
|
|
|
its not possible to send u the whole code related to this coz its too long so only sending u chunks from it,i hope it will help u to understand our problem
//this method is called after every 10 seconds by timer event
public void ConnectDB(Object obj, EventArgs ev)
{
myTimer.Stop();
String query = "/////////////some selection from DB";
aReader = DB.ExecuteReader(query);
projectDB.Clear();
while (aReader.Read())
{
//structure is a Struct containing a string and an int variable
//after gettings latest values from db in structure v add it
// in projectDB arraylist
structure.proj_name = aReader.GetString(0);
structure.compl_status = aReader.GetInt32(1);
//to lock the projectDB array list here
Monitor.Enter(projectDB);
projectDB.Add(structure);
//to unlock the projectDB arraylist here
Monitor.Exit(projectDB);
}
DB.Close();
if (!list_status.Contains(s))//some check i think u dnt need to understand it
{
exit_flag = true;//to disable timer
}
else
{
myTimer.Enabled = true;//to enable timer
}
}
another method of the same class that is using value of this arraylist
///////////////code where v r reading values from projectDB
if (Monitor.TryEnter(projectDB))
{
//projectDB is an arraylist filled with info from database
temp_projDB = (compile_status)projectDB[index];
}
else
continue;
//////////////////
Thanks
|
|
|
|
|
I see three problems with the code:
1. You clear the list outside the monitoring.
2. You enter and leave the monitoring for each item you add, leaving the list in different state every the time.
3. You never leave the monitoring when you read from the list.
---
b { font-weight: normal; }
|
|
|
|
|
I have made a windows service and deployed it using installutil utility. Now i want to remove it as i have to make some changes in the original service. How can i remove the service.
I have another problem. Whenever we pass an insert statement against database table the exception can be cathced by using sqlexception parameter. I have done with exception where there is a problem with the primary key because i know the error code it genereates when there is a primary key error. But how can i do the same type of checking when there is an error related to foreign key. Wht is the error code for foreign key related errors.
Any suggestion is well received. thanx in advance
|
|
|
|
|
To uninstall windows service use installutil/u from your visual studio command prompt like installutil/u <your assembly="" name="">
and for the next one i hope you should ask in sql forum.
Luck is Opportunity with hardwork
|
|
|
|
|
How to get the values of some properties in the class
Like I have a Class ... Class1 in which some properties are defined say FName, LName..
What I want is that I want to apply this thing to many classes of which I don't know the properties that it contains as in....
in class1 it may be FName or LName
but what is in class 2 I don't know
I want to have some common code that will apply for all the classes I want.
the problem with this one is that here I have to call the values of all the properties individually
How can I do this?
Please reply.
Thanks in Advance
Parag Gupta
|
|
|
|
|
Hello
I don't think I fully understand your question, but if you want to browse through all properties of a certain type -not instance- and get their names then call Type.GetProperties() method. If you have a certain object of that type, and you want to check the value of that property, then get the PropertyInfo and call PropertyInfo.GetValue() method supplying it with the object you want to check for that value.
I hope this was helpful.
Regards
|
|
|
|
|
Salaam to All
i m Ahsan and doing MCS , I have to connect a Prolog KB to my C# application, can any1 help me....
will be very thankful for ur concern...
Regards
Ahsan
|
|
|
|
|
Hi...
I want to access/use parent forms variables from child forms. Those varibles in parent form i have declared as 'public' also but i am not able to access parent forms varibles from child form...i doing something like this to access paremt form variables...
this.ParentForm
but no result...can anybody suggest me anything...
Also can anybody suggest me any document on MDI Parent-Child application.
Thanks,
Vinay
|
|
|
|
|
Hello,
Is your parent form a Standard System.Windows.Forms.Form?
If not, and you would like to get access to a user property, you would have to cast it to your userform.
UserForm userform = this.ParentForm as UserForm;
if(userform!=null)
{
userform.??? //Do youre stuff!
}
Hope that helps you!
All the best,
Martin
|
|
|
|
|
make that variable static and use it my the class name ..so no need to create any object
sameer
|
|
|
|
|
ya...its a standard windows form...
Actally my application is something like this...
I hv created the MDI application in which parent form contians some ToolStrip buttons. I will call the child forms through menus. On some button click events of the child form items i have to get some parent form variables & i have to do some operations...(e.g get string from parent & write in a richtextbox)
Can u tell me how i can do that...?
Regards,
Vinay
|
|
|
|
|
Hello,
Are you getting an Exception during runtime, or is youre code not compilable?
|
|
|
|
|
i hope my previous solution should work. here anothr for you
pass your parent form object in the child form and store it like;
object parmObj = parentObject;
and now access parent form public methods/variable by type casting it by ur parent form class name. ie.
((ParentForm)parmObj).Variable;<br />
((ParentForm)parmObj).Method();
sameer
|
|
|
|
|
I am working on a messenger application in c#.there is a browse part where admin can open any page through browser and i want that when admin can use the scrollbar at their end then that should be reflect to att the other client.Since this application is basically for classroom feature or for presentation.But i dont know how to use this facility
Aman Nigam
|
|
|
|
|
That is not practically possible. That would require that all the computers use the same resolution, has the same windows theme, use the same browser, open the browswer window with the exact same size, have the exact same settings for browser toolbars, have the same setting for browser text size, et.c.
I would rather go for displaying an image of the teachers browser instead.
---
b { font-weight: normal; }
|
|
|
|