|
|
MSDAORA is a 32 bit client. You have two choices really.
1. Compile your application as x86 instead of Any CPU. This forces the application to use 32 bit, so will pick up the DLL.
2. You need to the the full Oracle OleDb[^] client instead.
|
|
|
|
|
thank you for your answer Pete O'Hanlon ... i try the first choice but it does not work for me ... and with the second choice i download the oracle driver but i don't how to use it? can you help me?
|
|
|
|
|
I am doing some exploration ... out of curiosity ... of the 'ExpandoObject in System.Dynamic; so far, I've been able to write a serialize/deserialize to XML function using DataContract, written a method to recursively print to Console all the name/value/Type of the members of a "nested" ExpandoObject.
As you may know, you can add executable code to an ExpandoObject as illustrated in this example:
dynamic TheExpando = new ExpandoObject();
TheExpando.NewProperty = "some new stuff";
TheExpando.NewBagOfProperties = new ExpandoObject();
TheExpando.NewBagOfProperties.DriversLicense = "A873T23L";
TheExpando.NewBagOfProperties.SocialSecurityNumber = "958-349-3988";
TheExpando.SomeInteger = 100;
TheExpando.AnotherInteger = 200;
Action aMethod = new Action(() =>
{
MessageBox.Show((test1.TheExpando.SomeInteger + test1.TheExpando.AnotherInteger).ToString());
test1.TheExpando.SomeInteger += 1000;
});
test1.TheExpando.AMethod = aMethod; And, yes, if you then called TheExpando.AMethod(); you would execute the anonymous method, bring-up a MessageBox, and increment the value of TheExpando.SomeInteger.
Note that I assume the negative hypothesis here: I don't think anonymous methods can be serialized ... not without some kind of very complex code that uses Reflection and yogic contortions. This is a tantalizing post on SO, however: [^].
So far, my research indicates that an Action like 'aMethod in the above code cannot be serialized with DataContract, even though this declaration of 'KnownTypes is legal in setting up a DataContract:
[KnownType(typeof(System.Delegate))]
[KnownType(typeof(System.Action))]
[KnownType(typeof(System.Dynamic.ExpandoObject))]
[DataContract]
public class SomeClassThatIncluesAnExpando
{
[DataMember]
public dynamic TheExpando { set; get; }
} It appears (from my reading on this issue, so far) that you can use a JSON serializer to write an anonymous Type, or Event declaration, to XML.
I have yet to evaluate the 'DataContractResolver facility which might (?) be useful: [^]. I am currently studying this article on serialization of anonymous Types: [^].
I'd appreciate hearing your thoughts on this. Is there any form of Delegate that can be serialized using DataContract ?
fyi: resources
1. ExpandoObject: Use of .NET's Expando object (FrameWork 4.0) in the Dynamic Language Runtime (DLR): [^], [^].
Anoop Madhusudanan has an outstanding article on programming with DLR, using Expando and DynamicObject, and his own very interesting "Elastic Object: [^]; also, see Anoop's blog: [^].
“The best hope is that one of these days the Ground will get disgusted enough just to walk away ~ leaving people with nothing more to stand ON than what they have so bloody well stood FOR up to now.” Kenneth Patchen, Poet
modified 7-Mar-14 1:11am.
|
|
|
|
|
BillWoodruff wrote: Note that I assume the negative hypothesis here: I don't think anonymous methods can be serialized Anonymous or not, methods aren't serialized. They're not data.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
A good ... perhaps even definitive ... point to consider, Eddy, but is a Lambda Expression something somewhat other than a method ?
I can certainly store Actions and Funcs in a Dictionary.
thanks, Bill
“The best hope is that one of these days the Ground will get disgusted enough just to walk away ~ leaving people with nothing more to stand ON than what they have so bloody well stood FOR up to now.” Kenneth Patchen, Poet
|
|
|
|
|
BillWoodruff wrote: Lambda Expression something somewhat other than a method ? Yes, it's a pointer to a anonymous method.
BillWoodruff wrote: I can certainly store Actions and Funcs in a Dictionary. ..but probably not serialize it, deserialize on a different PC and still have code in there. The pointers would be there, the objects, the count - but not the code. That would have been compiled/optimized to a specific CPU; can you guarantee the same CPU on the target-machine? The correct bitness of the runtime?
You could decompile the code, and compile it again on the target-machine. That'd me somewhat costly, so you might want to keep a copy of the compiled assembly around. The question is rather "what do you want". Depending on that, I'd recommend using an (very generic!) interface, or, perhaps neater, CSharpScript[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy, your replies make perfect "common sense;" I am now wondering how I came to wander so far out on this very shaky nether-limb of the tree of reason
I think this post on SO: [^], coupled with a feverish imagination, led me to an unwarranted generalization of a possible solution for serializing anonymous Types to the idea of serializing anonymous methods.
Both your replies up-voted.
thanks, Bill
“The best hope is that one of these days the Ground will get disgusted enough just to walk away ~ leaving people with nothing more to stand ON than what they have so bloody well stood FOR up to now.” Kenneth Patchen, Poet
|
|
|
|
|
BillWoodruff wrote: your replies make perfect "common sense;" Happy
BillWoodruff wrote: led me to an unwarranted generalization of a possible solution Key is the word "possible", and yes, nice to see some experimenting and curiosity. Also sounds reasonable to want to serialize code, as one could (e.g.) include the POCO's with the entities. Something like a CSV that contains a type-safe .NET class to handle the data.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
<pre>
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Applica
{
class Program
{
static void Main(string[] args)
{
DirectoryInfo da = new DirectoryInfo("C:\\Folder7");
FileInfo[] Arr = da.GetFiles();
if (Arr.Length == 0)
{
throw new InvalidOperationException("No files found.");
}
FileInfo ap = Arr[Arr.Length - 1];
ulong Totbyte = (ulong)ap.Length;
string filePath = ap.FullName;
string temPath = Path.GetTempFileName();
byte[] data = File.ReadAllBytes(filePath);
File.WriteAllBytes(temPath, data);
byte[] dataa = new byte[1];
for (ulong counter = 0; counter < Totbyte; counter++)
{
dataa[0] = data[counter];
BitArray bits = new BitArray(dataa);
for (int count = 0; count < bits.Length;)
{
if (count != 7)
{
if (bits[count] == false && bits[count + 1] == true)
count++;
if (bits[count] == false && bits[count + 1] == false)
count++;
if (bits[count] == true && bits[count + 1] == true) count++;
if (bits[count] == true && bits[count + 1] == false)
count++;
Console.WriteLine("count = {0}", count);
}
}
}
}
}
}
|
|
|
|
|
When your loop is in its last iteration, count == bits.Length - 1 , so guess what count + 1 is equal to?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
No its not. Look at the output. I ran the entire alphabet with no problem, but soon as I try to run just one or any special ascii characters like µ it gives an error.
|
|
|
|
|
OK, I might be wrong. I didn't trace the code, I only gave a quick look. My apologies.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
You're incrementing the count variable within the loop, and then trying to access the item at the new incremented index without checking whether it's in range. Once the count is out of range, the indexer will throw an IndexOutOfRangeException .
Add a test to the start of each if block to ensure that the index is still in range:
if (count < bits.Length - 1 && bits[count] == false && bits[count + 1] == true)
count++;
if (count < bits.Length - 1 && bits[count] == false && bits[count + 1] == false)
count++;
if (count < bits.Length - 1 && bits[count] == true && bits[count + 1] == true)
count++;
if (count < bits.Length - 1 && bits[count] == true && bits[count + 1] == false)
count++;
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Your solution did not produce an error, but it I still cannot understand why it allowed to process the ENTIRE alphabet in one shot. It would not even allow me to process one(1) special character with producing an error. Can you please explain why this? I simply cannot wrap my thoughts around it.
|
|
|
|
|
For ASCII characters, the byte values will be 127 or less. These bytes do not have the most significant bit set. For byte values greater than 127, the most significant bit is set.
Due to the way you've constructed your loop, if the most-significant bit is set, you will increment count out of range within the loop, and without the range checks in place, you'll get an exception.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I looked at my program for two (2) days straight. I looked at it night and day and could not make heads or tails of the problem. At one point I thought I was going to lose my mind. I am not sure I that I understand your explanation completely, but thanks. I really needed some sort of explanation so I put my mind at rest. Thanks.
|
|
|
|
|
The best part about this is that if you make it work, i.e. don't increment count before checking values again, the entire content of the if statement simplifies to
count++;
Console.WriteLine("count = {0}", count);
... because you are testing all combinations.
I'm not sure what you're trying to do but I'm sure the code is not doing it.
|
|
|
|
|
I was also reading online and saw that many people had this same problem. One of the experts said it was a dot.net error and that people should contact Microsoft tech support for a fix.
|
|
|
|
|
This is indeed a very strange problem to experience. I ran the entire English alphabet all at once and did not get an error. I ran only one special character and got errors every time.
|
|
|
|
|
That's what I thought at first, but it's not quite that simple. If condition 1 is met, you move to the next index, and test condition 2 against the new index. Therefore, it's possible to increment the indexer at least three times within the same iteration of the loop.
For example:
0 1 1 0
^
(condition 1 is met)
0 1 1 0
^
(condition 2 is not met)
(condition 3 is met)
0 1 1 0
^
(condition 4 is met)
0 1 1 0
^
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That's true as it stands but I'm pretty sure that's not what's intended, because incrementing count multiple times can easily result in an out of range exception.
|
|
|
|
|
Hello all,
I am using sqladapter and update command in it. I am checking how update command does the functioning. For reading the command i am using getupdatecommand.commandtext and the command which comes to me is
UPDATE [empdata] SET [name] = @p1, [id] = @p2, [salary] = @p3 WHERE (([name] = @p4) AND ([id] = @p5) AND ([salary] = @p6))
where name,id and salary are the tables in db. I am not able to understand what these @p are and how is all this working. I will be very thankful for its explanation.
modified 6-Mar-14 15:02pm.
|
|
|
|
|
The @name stuff is a parameter, and it allows you to transfer information from your C# code to SQL without converting it to string, or concatenating strings. This is important, because not using parameters can be very dangerous.
Suppose you have a string you want to update against an integer id:
using (SqlConnection con = new SqlConnection(strConnect))
{
con.Open();
using (SqlCommand com = new SqlCommand("UPDATE myTable SET myColumn1='" + myNewString + "' WHERE Id=" + myId.ToString(), con))
{
com.ExecuteNonQuery();
}
}
Will work, but it leaves you wide open to something called SQL Injection Attacks, where I can use the value in the string to add commands to the UPDATE: if the myNewString variable contains
Hello';DROP TABLE myTable;--
Then what gets passed to SQl is a comannd string:
UPDATE myTable SET myColumn='Hello';DROP TABLE myTable; Which as far as SQL is concerned is two valid SQL commands and a comment.
It updates every row in your table to "Hello", and then deletes the table.
Parametrized queries are a way to avoid that.
using (SqlConnection con = new SqlConnection(strConnect))
{
con.Open();
using (SqlCommand com = new SqlCommand("UPDATE myTable SET myColumn1=@MYSTRING WHERE Id=@ID", con))
{
com.Parameters.AddWithValue("@ID", myId);
com.Parameters.AddWithValue("@MYSTRING", myNewString);
com.ExecuteNonQuery();
}
}
Passes the same info to SQL, but the string value is now passed as a parameter and not interpreted as an SQL command at all.
It is a very, very good idea to use parameters at all times - it prevents other problems as well!
[edit]Typos - loads of typos... [/edit]
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Have you just given your email address to a Danish member[^] who joined 11 years ago and has never participated since?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|