|
ok foxpros codepage is 1252 and it dose allow for characters above 128 it is double-byte characters
what else could i try
chad
|
|
|
|
|
As I asked before - are you encoding the encrypted byte[] array (which the .NET crytography classes create) as text? You have to use hex, base64, or some other encoding to save the cipher data as text. It is not enough to use Encoding.GetString , since many of those bytes are unprintable (and therefore can't be copied and pasted - something you said you're having problems with). Why do you think that notepad.exe displays tons of "funny" characters when you open a binary file (like a .dll or .doc)? It's not text - it's binary.
Trust me - I've been working with cryptography long before .NET. You must encode it as text that can be stored correctly, which is why I mentioned Convert.ToBase64String and Convert.FromBase64String . There's also several articles here on CodeProject and replies in this message board about saving cipher data as hex-encoded (base 16) strings. Both are pretty easy to do.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
how to capture image from media player video?
|
|
|
|
|
Hi,
I have a table (ms access db) that has dates in each row. I want to be able to fill a dataset with records that fall within a date range. I'm using two dateTimePickers (win form) for start and end dates. How would I go about this? Should the dates in the access db be formated as date/text/number? Thanks for any help you can give.
Ron
|
|
|
|
|
Found it,
I was able to use the sql code below and have it work... don't know if it's the best or not. Didn't seem to matter if the date was text or Date DataType in db file.
SELECT * FROM Orders WHERE OrderDate>=? AND OrderDate<=?
Ron
|
|
|
|
|
See if the manufacturer of your video setup has an SDK available and use that. Otherwise, you can use the Windows Media Capture 9 suite, which you can get here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi, I'm trying to find a way to get the names of tables in a .mdb file programmatically. The OleDBDataAdapter requires that you use an SQL select statement, but that's a bit hard if you don't yet know the table names in a file. Any help, tips?
Thanks, Brian.
|
|
|
|
|
|
Hi, here's a code snippet of what I'm trying to do, but it throws an exception when I try to fill the dataset. I'm not familiar enough with .NET database stuff to know if this is the right way to go about it. Any ideas?
Thanks.
DataSet myDataSet = new DataSet();
string strAccessConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ dataFile;
string strAccessSelect = "SELECT Name FROM MSysObjects WHERE Type = 1 AND Name LIKE 'MSys%'";
try
{
OleDbDataAdapter myDataAdapter = new OleDbDataAdapter (strAccessSelect,strAccessConn);
myDataAdapter.Fill(myDataSet,"MSysObjects");
DataTableCollection dta = myDataSet.Tables;
Int32 iCount = dta.Count;
for(Int32 i=0;i
|
|
|
|
|
First of all, you want WHERE Type = 1 AND NOT Name LIKE 'MSys%' , as I wrote in my reply to your original post.
Second of all, don't waste time and resources with a DataSet when you only need a single column anyway:
using (OleDbConnection conn = new OleDbConnection(strAccessConn))
{
using (OleDbCommand cmd = conn.CreateCommand())
{
cmd.CommandText = strAccessSelect;
conn.Open();
OleDbDataReader reader = cmd.ExecuteReader();
while (reader.Read())
cbTables.Items.Add(reader.GetString(0));
conn.Close();
}
} This is much more efficient - using a forward-only data reader instead of creating a DataSet schema and filling it, which is good for disconnected data, but terribly inefficient for something like this.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
You might want to go into a little detail describing what you want to do. "How to config..." doesn't tell us anything...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You could always just do a "Your welcome." response and leave it at that. Clearly they don't even have the time to explain the problem and yet they want you to spend time figuring out their problem.
There is a slight inequity in this case....
|
|
|
|
|
I agree with Dave; if you need help, you need to be as specific as possible about what you need help with and what errors occured (no applicable here, of course) if any.
I do see what you're asking in this case, though. First you must understand that once a config file is read-in, it cannot be changed (well, at least the application won't recognize any changes). The reason is that the config section handlers, once read, are cached.
So, you either have to write changes to your .config file (make sure you keep what you don't modify in-tact) and restart your application (this is how ASP.NET works - a separate AppDomain monitors Web.config for changes and restarts the ASP.NET web application's AppDomain) and or use a different medium (some arbitrary XML configuration file, INI file, the registry (not recommended), a database, etc.).
Another option is to - for your own custom sections (see IConfigurationSectionHandler ) - create a settings class (what the section handler would return after the .config file is read) that can be changed programmatically and your code that uses those settings should not cache them.
For a good article on this topic, read An extension for a Configuration Settings class in .NET[^] here on CodeProject.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Suppose I have a custom type made of a list of floats, and I want to represent it compactly in XML like this:
<MyType>[2.718, 3.142, 1.613, 1.000]</MyType>
Suppose also that I have a dataset, with a datatable where one of the columns uses MyType, which is a essentailly a float[].
My question is this: How do I ensure the tag is written into this format and read properly back into the float[] when I use ds.WriteXml and ds.ReadXml mehtods? Is there an interface or something I implement in my custom type to write on the contents for the tag and also to parse it back in?
-- James --
|
|
|
|
|
Not without having to serialize the entire DataSet itself (using the undocumented IXmlSerializable interface) - not exactly something you want to do (it gets pretty complex if you want to remain compatible with the functionality of the DataSet ).
You could try, however, to create a typed DataSet (using xsd.exe or the DataSet designer in VS.NET - right-click on your project or project folder, select Add->Add New Item and add a "DataSet"), then modify the hidden source code (use Project->Show All Files) to transform a string into a float[] .
Keep in mind, however, that most databases (Oracle is the only major database I can think of that can hold an array, IIRC) can't hold arrays. So, in Access, MS SQL Server/MSDE, MySQL, etc., this would only be a string. So should it be in your DataSet (well, in most cases). Your caller should be responsibe for serializing and deserializing that string to/from a float[] , from a logical perspective.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart wrote:
Keep in mind, however, that most databases (Oracle is the only major database I can think of that can hold an array, IIRC) can't hold arrays. So, in Access, MS SQL Server/MSDE, MySQL, etc., this would only be a string. So should it be in your DataSet (well, in most cases). Your caller should be responsibe for serializing and deserializing that string to/from a float[], from a logical perspective.
Your right. This is probably a better way to go. Thanks for your insight on this.
-- James --
|
|
|
|
|
What can i do to shut down a computer near me ( on the LAN 1network )
Thanks
Rock Throught The Night
|
|
|
|
|
First, the account your running your app under must have Remote Shutdown privileges on the target machine to shut it down. After all, you can't just be any old user and shutdown someones else's machine. Next, you'd have to P/Invoke the InitiateSystemShutdownEx API call with the name of the target computer to shutdown. Docs on this call begin here[^]. A little extra C# specific information can be found on PInvoke.net here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Why did that get voted down? Seemed like a reasonable answer to me. (I didn't know how to do this before as I've never had the need to find out but it seems a reasonable answer)
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
Probably because I didn't supply any actual source code. Hey, I thought the DllImport line on PInvoke was hint enough. That line plus one more line of code to actually execute it and your done. But I guess that's what I get for forcing someone to do a little work to learn something. I just don't have to the time to write a sample app for every single post, but, apparently, some people expect that.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
<soapbox><blowOffSteam>
I know what I did wrong! I didn't write up a Whitewaper on the the use of System Shutdown functions. The various methods that could be used, and their pro's and con's. Can't forget to cover the security concerns, and OOOh!, AbortSystemShutdown. Need to add a plethora of sameple code too and a couple of complete apps.
Hey! Sounds like an article for CP! I haven't written an article yet, just because of the abuse that comes back when not evey single person who read your article got everything they were looking for, like Cut & Paste source. I'm still debating wheather or not I want to put in the time to do that, then put up with a bunch of n00b's who don't have a clue what they're doing, insisting your code doesn't work. Oh! And if it does work, it doesn't work exactly the way they want it.
</blowOffSteam></soapbox>
I've seen that logo. Man, 30 seconds work in Photoshop, MSPaint would have taken longer... and just because your the only person at the company, it doesn't make you a CEO, but your garanteed to be the mail boy!
But, we keep coming back here doing this day after day because we have this need to want to help people. I'd have to say it's kind of an addiction for me! My girlfriend can attest to that!
Oh well, back in the trenches I go! I've even got a couple of ideas for some articles...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
and just because your the only person at the company, it doesn't make you a CEO, but your garanteed to be the mail boy!
Excellent!
I'm an addict, too, though my contant work schedule drives me away from my computer most times to spend time with my wife*. I just like to help people, and we've both gotten times where people actually take the time to respond and say "thank you". I like that and it shows that there are still decent people left who, while they may not be able to solve their problem themselves (and no one can all the time anyway), they are willing to accept any help and are grateful.
* The guy actually had the nerve to say that posting 1,000 / month is something I shouldn't boast about (which I wasn't, merely pointing out the fact that he and his little buddy are wasting my time - not vice versa - by saying "it doesn't work" and expecting me to debug their code for them) and that's why I spend so many lonely nights. I mean, if you're going to attack someone's character, you should at least check their bio. I think being married would definitely be an indication of not spending lonely nights.
It's good to blow off some steam sometimes, huh? After all the time you I, and a few others put into this forum, pressure and irritation are bound to build-up. I mean, we're only human (at least that's the guise I stick to).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart wrote:
I mean, we're only human (at least that's the guise I stick to).
I won't tell anyone!
It's good to hear a "Thank You" now and then. It helps us to keep coming back for more!
Anyway... Thanks Heath! Keep posting the GREAT work! I'm learning something new from you every day!
I've gotta get out of here, go wine and dine the little woman, and get in some cuddle time! See y'all tomorrow!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|