|
Hi,
I wantt o know how can I detect if a mass storage devices was plugged in?
My aim is to block the mass storage devices like the USB flash memory, external hard disks & USB MP3 players as soon as user entered it..
|
|
|
|
|
You can iterate over drives and work out which ones are external. But, I don't see how you hope to 'block' them.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
what about detecting it...
and provide an option to block or unblock..
so the application will use the group policy to block and unblock.
|
|
|
|
|
When the code below executes,the btnSendMessage_Click method(Send Message) can complete normally.
But the btnReceiveMessage_Click method blocks at 'queue.Receive();' without any exception.Why can't
receive message?Do I need to configure my OS(Windows XP) yet ?
Any help will be appreciated!
private void btnSendMessage_Click(object sender, System.EventArgs e)
{
System.Messaging.MessageQueue queue =
new System.Messaging.MessageQueue(".\\Private$\\MSMQDemo");
System.Messaging.Message message = new System.Messaging.Message();
message.Body = txtMessage.Text.Trim();
message.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] {typeof(string)});
queue.Send(message);
}
private void btnReceiveMessage_Click(object sender, System.EventArgs e)
{
System.Messaging.MessageQueue queue =
new System.Messaging.MessageQueue(".\\Private$\\MSMQDemo");
System.Messaging.Message message = queue.Receive();
message.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] {typeof(string)});
txtReceiveMessage.Text = message.Body.ToString();
}
|
|
|
|
|
To my surprise,when I use the Computer Management tool in Windows XP,the message sent doesn't exist in the queue.But the process of sending message doesn't result in an exception!Why,why?
|
|
|
|
|
Is the queue Transactional?
|
|
|
|
|
No,it isn't transactional!
|
|
|
|
|
well that's the only way that I can reproduce the problem. On a Non-Transactional Q your code works fine; with anything else I try to make it fail it throws an exception on queue.Send(...).
|
|
|
|
|
Hi,Jimmanuel!
Why didn't the message sent exist on the queue?
|
|
|
|
|
well, like I said, the only way that I could reproduce your problem was to make the Queue transactional in which case you need to supply some extra arguments to the Send method; example here[^]
other than that your code works on my system. If that's not the problem then I'm not sure what to suggest for you.
|
|
|
|
|
Hi,Jimmanuel!
Thank you very much!
I knew the reason why the message sent didn't exist on the queue.
The Message Queue is set to be transactional while my code is non-transactional.
But surprisingly,the code doesn't throw an exception!Why?
Thank you very much again!
|
|
|
|
|
I don't know why it doesn't throw an exception, but at least it's easy enough to check for in code. Glad you got it worked out!
Jim
|
|
|
|
|
Hi there I'm getting the following error when working with Crystal maby there is someone that can help???
Error 717 Error in file c:\report.rpt: Failed to load database information.
I'm working with an old foxpro database and I've checked the report path and all that is fine. It still doesn't work.
Thanks in advance
Stephen
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
i am developing c# desktop application. in that i want to connect to mysql database which is resides on another system.please give me an idea about this.
i have already replaced [
Data Source=MySQL Database;Server=localhost; user id=root;password=****;database=sample;pooling=true";] to
[Data Source=MySQL Database;Server=http://192.168.1.64; user id=root;password=gvsadmin;database=sample;pooling=true";]
is there any other way todo this?
this connection gives out the error Unable to connect to any of the specified MySQl host
thanks
|
|
|
|
|
You just asked this few posts down. You got a reply as well. Then why repost? Did you tried anything?
Try this website.[^]
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
You're an idiot.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
dilip514 wrote: [Data Source=MySQL Database;Server=http://192.168.1.64; user
192.168.1.64 IS A LOCAL IP, go to http://www.whatismyip.com and get your ip from there and use that, also, forward your ports properly.
|
|
|
|
|
Hi,
I have many checkboxes inside a TableLayoutPanel() control.
I have added a another checkbox named SelectAll outside the table..
I used the following code for the SelectAll option, but it does not work...Please help me with this
private void SelectAll_Click(object sender, EventArgs e)
{
if (SelectAll.Checked)
{
cb.Select();
cb1.Select();
}
}
|
|
|
|
|
AFAIK there is no Select method in CheckBox class. Checked is the property you should use.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
if (SelectAll.Checked)
foreach (var checkBox in this.tableLayoutPanel1.Controls.OfType<checkbox>())
checkBox.Checked = true;
Eslam Afifi
|
|
|
|
|
The checkboxes are not on the form but on the panel.
this. is assumed if not specified so your code reads:
this.cb.Select();
If you try:
for (i = 0;i < many; i++)
{
string checkname = "cb" + i.ToString().Trim();
checkbox checkitout = (checkbox) this.NameOfPanel.Controls[checkname];
checkitout.Select() = true;
}
This is aircode, so please mind the caps. I also don't know what the Select() property is, but I'll assume you've defined your own checkboxes.
you also see that it is advisable to rename the first checkbox from cb to cb0.
succes !
|
|
|
|
|
Hi
i have a dagaridview view bind to an empty dataTable, user can insert values directly into datagridview and then click Save. when user clicked Save button, i write this code to iterate through dataTable records and insert to my database in transaction mode :
using (SqlConnection con = new SqlConnection("data source=.;initial catalog=test;Trusted_Connection=Yes"))
{
SqlCommand cmd = con.CreateCommand();
cmd.CommandText = "insert Person(titleId,fname,lname) values(@titleId,@fname,@lname)";
con.Open();
System.Transactions.TransactionOptions trOptions = new System.Transactions.TransactionOptions();
trOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
trOptions.Timeout = new TimeSpan(0, 0, 15);
using (System.Transactions.TransactionScope ts = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, trOptions))
{
try
{
foreach (DataRow row in this.dt1.Rows)
{
int titleId = int.Parse(row["titleId"].ToString());
string fname = row["fname"].ToString();
string lname = row["lname"].ToString();
if (cmd.Parameters.Count > 0)
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("@titleId", titleId);
cmd.Parameters.AddWithValue("@fname", fname);
cmd.Parameters.AddWithValue("@lname", lname);
cmd.ExecuteNonQuery();
}
con.Close();
ts.Complete();
}
catch (Exception ex)
{
}
}
}
I want, all of insertion execute in transation, for test, at runTime i was entered correct row in first datagridview row and then entered incorrect row in second with cause exception, but at runTime the first records has been inserted wheras i want when error has occured, all inserted records rollback.
Can anybody help me ?
Thanks
|
|
|
|
|
Use BeginTransaction, Commit and Rollback methods in SQLTransactionClass.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
Hi d@nish
Yes i know this, but i want to do this by TransactionScope calss and i want to know where does my mistake and how to solve it ?
thanks
|
|
|
|
|
Hi,
Is there any way to avoid restricted method while iterating the method using GetMethods() and properties using GetProperties().
GetMethods() - Using Binding Flags we can filter public ,static,Instance methods.How tofilter out restricted methods.
Generealy Restricted methods are not available for macro progarmming language like VB.
Pls help me ...
By
Rajanbabu
Rajanbabu
|
|
|
|