473,748 Members | 5,230 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Value Required outside the context [Very Urgent Please Help Me]

21 New Member
Hi everybody!

I have a problem and need help

Here is the code.

Expand|Select|Wrap|Line Numbers
  1. public void GetAllValues(Person V)
  2.         {
  3.             SqlConnection conn = new SqlConnection(ConnectionString);
  4.             SqlCommand objSql = new SqlCommand();
  5.             objSql.Connection = conn;
  6.             objSql.CommandType = CommandType.Text;
  7.             objSql.CommandText = "INSERT INTO Visitors (Name, Email) VALUES (@Name, @Email);";
  8.  
  9.             objSql.Connection = conn;
  10.  
  11.             objSql.Parameters.Add("@Name", SqlDbType.NVarChar, 50).Value = V.Name;
  12.             objSql.Parameters.Add("@Email", SqlDbType.NVarChar, 50).Value = V.Email;
  13.  
  14.             conn.Open();
  15.  
  16.             objSql.ExecuteNonQuery();
  17.  
  18.             conn.Close();
  19.  
  20.  
  21.  
  22.         }
i need the value of V.Name outside the braces i.e {} Highlighted like that

string a = V.Name;

Please help me i am in trouble
Sep 8 '09 #1
2 1341
tlhintoq
3,525 Recognized Expert Specialist
Please use [code] tags in your posts.
Sep 8 '09 #2
tlhintoq
3,525 Recognized Expert Specialist
Make a string variable that has a greater scope. Either the scope of the entire form, or the entire class, or the entire application etc. Then assign then name to that variable.
Sep 8 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
1912
by: ???????J | last post by:
Javascript may inquire the push down menu value, can I inquire the description? The following example, the variable($answer) can be get the menu1's value. For example, if I select first data, the menu1's value would be 1. Therefore ($answer) would be 1. But If want using javascript get the description(ABC),which javascript command can do it?
1
1280
by: Kathy | last post by:
Hi All I have a problem - I have an visual basic application that I am currently converting to .Net - I have a very necessary function that disconnects users from files on a specific network drive I was using the following API's NetFileEnum (enumerates through the files so that I can find the session of the specific file I want to disconnect) NetApiBufferFree
5
1229
by: lkrubner | last post by:
Is it true that Javascript has no clone() method, to pass an object by copy of value instead of reference? If I have an object and want to make an array out of all of its instance variables, I can loop through it and pass its values to a new array, and the class instances will be passed by copy and not by reference?
7
13637
by: deepagulati | last post by:
Hi, I need an urgent help from you. When we dynamically genrate any list box (Select Box) it shows one default value as selected. Is there any way that we can deselect that value. I tried with document.form_Name.ListBox_Name.options.selected =
6
2435
by: Kermit Piper | last post by:
Hello, I thought this should be easy, but... all I want to do is set the value of this state drop-down based on a session var I'm getting back from a redirect (from the processing page): <% tax = session("Tax") city = session("City") state = session("State") %>
1
2040
by: Simon Harvey | last post by:
Hi everyone, If anyone can help me with the following - I would be VERY grateful. I need to deploy an 2 ASP.net applications that I've been creating onto one of our live servers. Both applications use the Microsoft Enterprise Library dlls and have them located in their respective bin directories. Everything works fine on my development machine.
7
16291
by: pooba53 | last post by:
I am working with VB .NET 2003. Let's say my main form is called Form1. I have to launch a new form (Form2) that gathers input from the user. How can I pass variable information back to Form1 before calling the Me.close() on Form2? -Stumped
14
20407
by: Abhi | last post by:
I wrote a function foo(int arr) and its prototype is declared as foo(int arr); I modify the values of the array in the function and the values are getting modified in the main array which is passed also. I understand that this way of passing the array is by value and if the prototype is declared as foo(int *), it is by reference in which case the value if modified in the function will get reflected in the main function as well. I dont...
10
2517
by: Brad Baker | last post by:
I have an asp.net/csharp application that requires a particular variable to work properly. This variable is usually passed via a query string in the URL when the application is first run but under certain circumstances the query string may not contain the variable. So I need some way of establishing a default value if one isn't set. Is there some way I can set a query string on page_load OR is there some way I can use a global variable...
1
9324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8243
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.