|
n_gchaitra wrote: dr1 = cmm.ExecuteReader
Change this to dr1.ExecuteScalar. Use ExecuteScalar when returning only a single value from the database.
"Let's face it, the average computer user has the brain of a Spider Monkey."
Bill Gates
|
|
|
|
|
Sorry to butt into your thread here, but there is a problem with this architectural approach. Suppose you have two users typing in values, and they both enter the same value. User 1 does the check to see if it's present and it says "Nope - ok to enter it here" because the row count is 0. User 2 does the check to see if it's present and it says "Nope - ok to enter it here" again, because the row count is 0. However, User 1 now inserts it into the table. When the code for User 2 attempts to insert the record, it is now duplicated.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O'Hanlon wrote: Sorry to butt into your thread here
No worries. Didn't really think of any race condition occurring. Could do some kind of record locking through the app, but even if he could mark the record as being currently in use, there could be a race condition on that, too...
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
|
Hi,
I've been trying to work out how to iterate through a collection object using reflection.
I have a class with a few simple objects, strings, single[] arrays, and one collection.
However, when I'm using the GetFields() method to retrieve the objects in my class, when it gets to the collection I am unable to view all the items in the collection.
dim coll as collection = FieldInfoObj.getvalue(obj)
console.writeline("Collection has " & coll.count & " items in the collection")
for each item as object in coll
do_stuff(item)
next
Although it correctly states that I have 4 items in the collection, item 1 is Ok. item 2 is 'nothing' and item 3 causes an error. But I do actually have 4 'singles' in the collection.
How do i access the collection objects using reflection?
I *think* I need to reflect into each object seperately, and not just iterate through them after setting the main collection object using the getvalue(obj) method as I would with the other system.xxx type objects (which work fine)
Could anyone provide a simple example of how to iterate through a collection using reflection?
Thanks in advance,
Phil.
|
|
|
|
|
What I don't understand is why you want to use reflection to loop through the items.
Why not test the collection if it is an IEnumarable and loop through the items with a normal foreach() statement. And afterwards use reflection to reflect into each single item?
-^-^-^-^-^-
no risk no funk
|
|
|
|
|
The problem I was having was that the collection object said that it had 4 items in its collection, but the for each loop was only getting back the first, the second being "nothing" and the third and forth missing completely.
Actually the problem was that I was using a db4o database and had not "activated" the object completely so when my collection object was given back from db4o, half of the collection object was missing!
After getting back the entire object from the database correctly, I can now go through the collection
I'm using reflection to examine the object as the program does not know anything about that object (plugin) - when it got to a "collection" object, the program broke and I was thinking that I was doing something wrong with reflection on a collection object. Although as you've pointed out, if its a collection object, you should just be able to loop through them and reflect on the objects it passes back.
Ah the joys of db4o
|
|
|
|
|
Hello everyone,
I am using installer from,
http://www.microsoft.com/downloads/details.aspx?familyid=C2B1E300-F358-4523-B479-F53D234CDCCF&displaylang=en#AdditionalInfo
on Windows XP SP2 machine. The installer always report an error (and pops up the popular message box of sending an error message to Microsoft). I have tried on two machines and the error is the same. But I do not know where to check the exact error log.
My questions are,
1. This package is for Windows XP SP2 or only Windows Vista?
2. Is it mandatory needed if I want to use Visual Studio 2005 + .Net 3.0 to do C# development?
3. Anyone has met with similar issues before?
thanks in advance,
George
|
|
|
|
|
1. This package is for Windows XP SP2 or only Windows Vista?
>> I think there is another SP avialble for using .net 3.0
2. Is it mandatory needed if I want to use Visual Studio 2005 + .Net 3.0 to do C# development?
>> No Not at All
--Akki
|
|
|
|
|
Thanks Akki,
>> I think there is another SP avialble for using .net 3.0
Can you provide an URL please? I think you mean there is a .NET SDK 3.0 for Windows XP + Visual Studio 2005?
>> No Not at All
My application is not using the new functions in .Net 3.0 (e.g. workflow) and only utilize the common functions. In this situation, my purpose is to test whether my application works with .Net 3.0 Runtime.
Do you think in my situation, I need to build my application again using .Net SDK 3.0? Or just using the old build (built by .Net 2.0) and run it in .Net 3.0 Runtime environment?
(I still doubt whether there are any differences in my application build, if I choose to use 2.0 SDK or use 3.0 SDK?)
regards,
George
|
|
|
|
|
First, I assume you already have .NET 2.0 installed? If not, you'll need that.
I also installed this Microsoft .NET Framework 3.0 Redistributable Package[^]
Then I installed the .NET 3.0 SDK some time later. You don't necessarily need it. I was doing mostly Workflow Foundation which only required the .NET 3.0 Redistributable + the Workflow Extensions designer. It was only when I did an experiement with WCF that I needed a utility that was in the .NET 3 SDK.
George_George wrote: Is it mandatory needed if I want to use Visual Studio 2005 + .Net 3.0 to do C# development?
It depends which bits you want to use. For WF you just need the .NET 3 redist + WF Desiner.
Kevin
|
|
|
|
|
|
Unfortunately, Microsoft have created confusion with their naming. There is no .NET 3 runtime as such. Everything uses the .NET 2 runtime. .NET 3 refers to .NET Framework 3 which is essentially just a bunch of new classes for WF, WCF, SPF and WCS. So you don't need to install .NET 3 at all if you're not going to be using any of WF, WCF etc.
Kevin
|
|
|
|
|
|
George_George wrote: Any need to install .Net 2.0 Runtime before install the Microsoft .NET Framework 3.0 Redistributable Package?
Yes.
Kevin
|
|
|
|
|
Thanks Kevin,
I have tested that Microsoft .NET Framework 3.0 Redistributable Package will install .Net 2.0 Runtime (like System.Data.dll) automatically, no need to install .Net 2.0 Runtime in advance.
regards,
George
|
|
|
|
|
Ah, I didn't know that.
Kevin
|
|
|
|
|
Anyway, thanks buddy! You helped me all the way.
regards,
George
|
|
|
|
|
I need to check the configuration, but I only see entries for 1.1 in Administrative Tools.
correction: I see it on one machine, not the other. How does this get installed?
I've Repaired the .Net 2.0, but still no entry for 2.0 configuration.
Paul Watson wrote:
Like, if you say sort of, like, you know, one more, you know, time, I'm going to, like, you know, sort of sort you out, you know.
|
|
|
|
|
You've probably installed the redistributable of the .Net Framework (2.0) - MS have moved the security tools to the SDK only.
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|
|
So, I need to install the SDK just to check the configuration on every client machine?
Paul Watson wrote:
Like, if you say sort of, like, you know, one more, you know, time, I'm going to, like, you know, sort of sort you out, you know.
|
|
|
|
|
|
martin_hughes wrote:
It's a good question, and I don't really know enough about CAS to offer much help to you... but I think the idea is that end users shouldn't be doing this kind of thing.
That's why access to the config should be available to admins. However, the admins still need acess to the config app, so it should be installed with the runtime.
|
|
|
|
|
I have a small full-trust app that uses SQL Server Express database on C drive.
It runs fine for me on that machine.
On other machines, I get the message "Application attempted an operation not allowed by security policy. To grant this application the required permission contact your administrator, or use the .NET Framework Configuration tool.
<snip>
Request for the permission of type
System.Data.SqlClient.SqlClientPermission.System.Data."
I am using admin user on both machines.
Is it because the database is on a remote pc, or does full trust lack something?
Also, I don't see any Configuration for .Net 2.0. Only 1.1.
-- modified at 10:42 Monday 16th July, 2007
Paul Watson wrote:
Like, if you say sort of, like, you know, one more, you know, time, I'm going to, like, you know, sort of sort you out, you know.
|
|
|
|
|
Check whether "Network Service" account is running in a user account having sufficient permissions.
--Akki
|
|
|
|
|