using

ASP.NET MVC - System.Data.DataSet not referenced problem

Hi There, Well, first of all sorry about this question it must be pretty straight forward for you guys but I'm struggling myself on it, and I need to make it work :( Well I'm trying t o use DataSet on my application and when I render it I got: The type 'System.Data.DataSet' is defined in an assembly that is not referenced. You must add...

How to pass "using"-type objects to a function?

I have a code that looks like this: using (DC dc = new DC()) { f(dc.obj, a); } void f(DC dc, int a) { ... dc.obj = a; } It doesnt work - complains about object reference and non-static fields. This is a console application, so it has Main() function. How should I make it work? I tried adding references as it asked: I ha...

Difference between 'using' and scoping?

What is the difference between the following two snippets of code: using (Object o = new Object()) { // Do something } and { Object o = new Object(); // Do something } I have started using using a lot more but I am curious as to what the actually benefits are as compared to scoping objects. Edit: Useful tidbits I took ...

Why doesn't 'using' have a catch block?

I understand the point of "using" is to guarantee that the Dispose method of the object will be called. But how should an exception within a "using" statement be handled? If there is an exception, I need to wrap my "using" statement in a try catch. For example: Lets say there is an exception created in the creation of the object insi...

Can a scope block with the "using" keyword react to exceptions?

Hi everyone, I have the need to do some logging within my code. I'm required to use an internal company-developed library to record some information. Here's how it works. Recorder recorder = Recorder.StartTiming(); DoSomeWork(); recorder.Stop(); // Writes some diagnostic information. To ensure that Stop() is always called, I creat...

validation with asp.net using javascript...

i have to validate listbox for maximum of three items to select by the user... i have write code that works fine... but if i'll use the same code in customer validator in asp.net it...pop ups the msg that please select maximum of three items..but after it, the page get post back to server...that should not happen... give me solution p...

Calling Dispose() vs when an object goes out scope/method finishes

Hi, I have a method, which has a try/catch/finall block inside. Within the try block, I declare SqlDataReader as follows: SqlDataReader aReader = null; aReader = aCommand.ExecuteReader(); In the finally block, the objects which are manually disposed of are those which are set at the class leve...

Typedef inside/outside anonymous namespace?

In a .cpp file, is there any difference/preference either way? // file scope outside any namespace using X::SomeClass; typedef SomeClass::Buffer MyBuf; v/s namespace { // anonymous using X::SomeClass; typedef SomeClass::Buffer MyBuf; } ...

How do I bypass the "Complete Action Using ..."

Hey guys, I have a question related to choosing an application programmatically when shown the dialog "Complete Action Using" in Android. An example would be as follow: In my code, I have this statement startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=98yl260nMEA"))); I will then shown a...

[C++] Why shall I use "using" keyword to access my base class method?

I wrote the code below in order to explain my issue. If I comment the line 11 (with the keyword "using"), the compiler does not compile the file and display this error: invalid conversion from 'char' to 'const char*'. It seems to do not see the method void action(char) of Parent class in Son class. Why the compiler behaves this way? Or h...

Applying using to a SqlDataReader

I just want to verify something. I believe it is likely that if I apply the using command to a SqlDataReader, that it will both close the data reader and dispose of it. For example: Using sdr As SqlDataReader = cm.ExecuteReader() Dim someInt As Integer = sdr.GetInt32(0) 'other details and actions End Using Will that close the ...

Disposing datacontext causes Invalid attempt to call Read when reader is closed

I'm building an MVC 2 app and using linq to sql with stored procs. I created a data access layer that has an internal datacontext class and a public class that I expose applications. In my public class I expose methods which access the datacontext class and convert the data to my own object model classes using linq. In my public class...

Standard convention for using "std"

Exact Duplicate: Do you prefer explicit namespaces or ‘using’ in C++? Which of these is a preferred convention for using any namespace? using namespace std; or using std::cin; using std::cout; or calling the function as and when required in the code? std::cout<<"Hello World!"<<std::endl; ...

C#: "Using" Statements with HttpWebRequests/HttpWebResponses

Jon Skeet made a comment (via Twitter) on my SOApiDotNet code (a .NET library for the pre-alpha Stack Overflow API): @maximz2005 One thing I've noticed just from browsing the source quickly: you don't disposed (sic) of WebResponses. "using" statements FTW. He indicates that I need to wrap these Web sessions in "using" stateme...

invoking method using Reflection Utils

hi, i want to invoke a method using reflection. i am having two projects AA and BB. AA has dependency on BB but BB does not have. Now the use case is that i have to call a class of AA from BB. can any one suggest me how to do that.. i have used ReflectionUtils class for the same.. Method getMethod = null; getMethod = ReflectionUtils....

Error adding reference to System.ServiceModel.Web.dll in VS 2010 Beta 2 with .NET Framework on Win 7 x64

Hi, I am creating a project that requires the System.ServiceModel.Web.dll. I have added a reference by right-clicking the reference "folder" in the project explorer. A search of the system shows System.ServiceModel.Web.dll in different directories: Program Files(x86), x64, GAC, etc. It doesn't seem to matter which one I pick, as I al...

C# 'using' Am I doing this right? (Inaccessable due to protection level)

http://www.dscredstorm.com/getisbninfo.aspx I'm trying to use Amazon's api. I downloaded their example code, which is a C# windows form app but I figured it should work for a C# website also, correct? SignedRequestHelper.cs is a file that appears to have some functionality that I need to send a signed request. It's namespace is Amazon...

usage of 'using' in .NET

In the example below, will the returned pen be destroyed(disposed) or not? ' VB' Public Function GetPen() As System.Drawing.Pen Using pen As New System.Drawing.Pen(_Color, _Width) pen.DashStyle = _DashStyle Return pen End Using End Function // C# public System.Drawing.Pen GetPen() { using (System.Drawing.Pen pen = new S...

How to get project wide Remove and Sort Usings for Visual Studio 2010?

We had the Power Commands for Visual Studio 2008 that add a context menu command that Removed Unused Usings and Sorted Usings for all files in a project/solution. How to do the same in VS2010 since this plugin is incompatible? ...

How to use Global Hook

Hi! I tried using global hook, and when I typed in using gma.System.Windows; it did not recognize gma? What do I need to do? ...