473,387 Members | 1,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to assign a value to variable via Reflection where var name and value are pulled

Hi,

I am new to Reflection in C#, and hoping someone could give me pointers on how to set a variable using Reflection. The variable name, type, and value are stored in a sql server database table. I am using a sql stored proc to pull the variable name, data type (int and string), and value from the DB then I want to loop through the result set and assign the values to the variables (that have already been declared at design time in the ASP.net aspx.cs).

I have googled this for a couple of days and have gotten close but have not been able to get exactly what I need.

Any help is greatly appreciated.

Brian
Oct 31 '10 #1
1 2252
GaryTexmo
1,501 Expert 1GB
Try taking a look a the InvokeMember method on the type of a class...

Expand|Select|Wrap|Line Numbers
  1. typeof(TheClassType).InvokeMember(...)
Oct 31 '10 #2

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

Similar topics

23
by: stewart.midwinter | last post by:
No doubt I've overlooked something obvious, but here goes: Let's say I assign a value to a var, e.g.: myPlace = 'right here' myTime = 'right now' Now let's say I want to print out the two...
4
by: Terry | last post by:
I have a number of input boxes used to display totals based on selected items for each row in a table. There are more than a few rows that are identical, except for the form field name. I have...
2
by: Matt | last post by:
If I assign Java variable a to javascript variable x, it is fine. <% int a = 10; %> var x = <%= a %>; alert(x); But if I do the other way around, then it has 500 error. any ideas??
3
by: daldridge | last post by:
Is there anyway to use the contents of a variable as the value of the 'name' attribute of an <xsl:attribute>? Suppose I have this XML input: <Foo> <Bar>Baz</Bar> </Foo>
8
by: Jan Kucera | last post by:
Hi, I have structure like this: namespace Namespace { public class User { public Subnamespace.Settings Settings = new Subnamespace.Settings(); } namespace Subnamespace {
7
by: rynato | last post by:
Simple question, probably a simple answer: I have a php-based email form. There are three hidden variables passed from the initial page to the php script which handles sending the message: ...
1
by: Ranjan | last post by:
Hi, I want to assign javaScript variable to JSP variable. <Script> var conf=Confirm("Mess"); if(conf) { <% String str=conf; /// line 1 %> }
1
by: backups2007 | last post by:
What I need to do is be able to pass a variable that gets assigned as a selected value to a dorp down box. I need to pass it to another page. Please help.
2
by: lovecreatesbea... | last post by:
Similar macros like "CONST_INT" in product code. Does it deserve this? Thank you for your time. /* a.h ***********************************************************/ #ifndef CONST_INT #define...
4
by: ajd335 | last post by:
Hi all, I have some results which I need to link with their original files. they are stored in variable $str how can I give a href a variable name ?? code is below <?php $str =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.