|
You can use System.IO.DriveType.Removable to find a removable drive. From there you can access it just like a normal drive.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
Here's a code project article about this subject:
http://www.codeproject.com/cs/system/DriveDetector.asp
An intellectual is someone whose mind watches itself.
Albert Camus
|
|
|
|
|
Hi, I'm attempting to perform a wild card query using C# and microsoft access. The results will be placed in a data grid. Ive tried using "*" ,"#" and "?" symbols but it still wont work
heres my query statement..
daGuests = new OleDbDataAdapter(string.Format("SELECT * FROM Assignee WHERE SN = '*{0}*'", search), conn);
daGuests is my data adapter
search is a string taken from a textbox..
is there something wrong with my code?
im pretty sure theres nothing wrong with my other codes,
the daGuests = new OleDbDataAdapter(string.Format("SELECT * FROM Assignee WHERE SN = '{0}'", search), conn); statement works perfectly.
Hope you guys can help.
|
|
|
|
|
I don't use Access anymore but the SQL should be closer to:
"SELECT * FROM Assignee WHERE SN LIKE '%{0}%'"
I'm not real sure about the % characters. They might be something else.
|
|
|
|
|
I consider that we could use 2 character '*' and '%' based on what I need
In SQL query, we use "Select * frm Assignee WHERE SN like 'Th%'"
In Crystal Report, we use CrystalReport1.DataDefinition.RecordSelectionFomular = "{Assignee.SN} like 'Th*'";
It seem to be a solution or an answer.
|
|
|
|
|
Hi,
On microsoft access, we have 2 wild characters, "*" and "?". So the mistake is in using "=" instead of the LIKE.
Try to use sentance as:
daGuests = new OleDbDataAdapter(string.Format("SELECT * FROM Assignee WHERE SN LIKE '*{0}*'", search), conn);
and I hope it will work for you.
Manoj
|
|
|
|
|
|
You should use Parameter to make it easier instead of formatting datetime.
string dateneeded = dateTimePicker6.Value.ToLongDateString();
String query = "INSERT INTO purchaserequest(dateneeded) VALUES (? )";
MySqlCommand command = new MySqlCommand(query, connection);
command.Parameters.Add(new MySqlParameter("pDate",dateneeded));
command.ExecuteNonQuery();
It seem to be a solution or an answer.
|
|
|
|
|
hi,
thanks...il try this one...
i appreciate it...
regards
jing
|
|
|
|
|
you just have to use the datetimepicker properties/methods
datetimepicker.value (one way to get the datetimepicker value)
|
|
|
|
|
jing,
You can try an essy way out.
Just put the "date-time" in single quote while preparing sql string.
i.e. your query string should be changed as below:
String query = "INSERT INTO purchaserequest(dateneeded) VALUES (" + "'" + dateneeded + "'" + )";
Also please check you have the correct column name.
Manoj
|
|
|
|
|
|
Hi all,
I want that the dll of my application which are on the client machine after deployment should be protected that no one can see the code and logic using some deassembler tool. How should i protect this???
i tested a third party tool to read a dll of some trial version application from internet. Its opens the code easily, but when i tried the same tool with some system32 dll, the dll showed to be locked. I want this to be in my dll also. How is it possible ???
Sample Code, Suggestion, References welcom ........
Thanx
sandeep
|
|
|
|
|
The system32 dll is written in C++. That's the only way to stop people from reading your code at all. Otherwise, all you can do is use an obsfucator.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I’m actually quite good at looking at x86 machine code and producing equivalent C++ code. It takes some time but it’s not impossible.
Steve
|
|
|
|
|
*grin* I know, but it's hardly trivial like reflector is.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I have an application that needs to connect to a webserver and download some files. When there is no proxy it works great. The problem is when the users are using an automatic proxy detection script. Is there any way I can find out the IP address of the proxy server that this script is making me use at runtime. If I have the IP address of the server I can then create a WebProxy based on the IP address and port and either make the user login or try and add the URL of the web server to the ByPass list. Thanks for your help.
Matt
|
|
|
|
|
I have posted this question before but didn't post the code.
The thing is for some reason, i cannot programatically Insert new row or update the database. However, I could fill the dataset after manaually populating the database.
Could any help me. The permissions are set right and the folder that contains the database file is also writable.
thank you.
below is what i have
ProductItemDataSet = new DataSet.DatabaseDataSet.ProductItemTableDataTable();
DataSet.DatabaseDataSetTableAdapters.ProductItemTableTableAdapter ProdAdapter =
new DataSet.DatabaseDataSetTableAdapters.ProductItemTableTableAdapter();
ProdAdapter.Fill(ProductItemDataSet);
ProdAdapter.Insert("man", "mango", "mango tree", "");
The database is in project Dataset. And this code exist in a different project but references the Dataset project.
Nana
|
|
|
|
|
Hello to Nana
you must use this code in FormLoad event for fill dataset:
prodadapter.fill(productitemdataset);
and use this code for add a new row to db:
ProductItemdataset.(TableName).AddNew(TableName)Row(field1,...);
ProdAdapter.Update(ProductItemDataset);
Good Luck.
Editali (Alireza Loghmani)
|
|
|
|
|
Does anybody know how to get an IntPtr to the executable that contains a resource?
I am successfully getting the assembly containing the type (which I assume [because it is the assembly to which the resource was added] should contain the resource) by calling Assembly a = Assembly.GetAssembly( t ); but how do you get an IntPtr to the executable that contains the resource (which I assume should be this assembly)? I can get a ModuleHandle structure from the assembly; but there doesn't seem to be a way to get an IntPtr to the executable from the ModuleHandle structure:
Type t = this.GetType( );
Assembly a = Assembly.GetAssembly( t );
ModuleHandle mh = a.GetModule( "APC" ).ModuleHandle;
I can get an IntPtr from Process.GetCurrentProcess( ).Handle, but this handle value does not appear to be valid (if indeed the resource I've added to the .DLL assembly are there, as they otherwise appear to be there). In other words, the IntPtr handle returned by the call into GetCurrentProcess does not appear to identify the assembly to which the resource belongs, whereas the call into Assembly.GetAssembly does identify the assembly I want a handle to, but I haven't found what processes to use to get a handle to *that* assembly from the assembly instance:
String s = "MT_ConfirmREFRESH";
IntPtr h = Process.GetCurrentProcess( ).Handle;
try
{
Glyph1.GMap = Bitmap.FromResource( h, s );
}
catch
{
throw new Exception( "Bitmap resource " + s + " not found from process handle " + h.ToString( ) + "." );
}
Succeeding in this is vital to implementing Bitmap.FromResource( IntPtr hinstance, String bitmapName ). I haven't found any examples that don't call into unsafe/unmanaged code. This means nobody is successfully retrieving bitmap resources embedded into class libraries?
That's a bit hard to believe.
|
|
|
|
|
Try using
Assembly.GetExecutingAssembly();<br />
Assembly.GetManifestResourceStream();
they work for me.
led mike
|
|
|
|
|
THANKS, MIKE. I gotta run... but I'll give this a go!
|
|
|
|
|
No, my call to Assembly.GetAssembly( t ) gets the assembly. That isn't the problem. The problem is getting an IntPtr handle to the assembly.
Any ideas on that? Since I can identify the proper assembly with Assembly.GetAssembly( t ), and since my call to IntPtr h = Process.GetCurrentProcess( ).Handle does not (?) appear to be returning a valid IntPtr to the executable containing the resource (my assembly returned by GetAssembly( t)), I am hoping there is somehow a way to get the IntPtr from my GetAssembly( t ) result.
That seems straightforward, but perhaps another way is intended to be the process.
In any case, all reasonable suggestions are appreciated. I'm traveling in just a bit, but will return to the forum in a few days.
|
|
|
|
|
In other words, you can't do this, and there doesn't seem to be a way to cast or otherwise derive the IntPtr value so that you could do the equivalent of this:
Glyph1.GMap = Bitmap.FromResource( ( IntPtr )Assembly.GetAssembly( t ), s ); So the question remains, How do you get an IntPtr to an executable containing a resource?
|
|
|
|
|
I don't know what to say at this point. As far as I am aware I gave you a solution that works, in my experience, and you have not tried it.
led mike
|
|
|
|