473,387 Members | 1,859 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.

pass different LINQ objects (by string name?) to the same(form-)constructor

Hi,

This is what I want to achieve:
I hav a lookup-form used by different parent forms to present a
database table. So form X uses the lookup to search table tblA, form Y
uses the lookup to search tblB.

The data in the lookup form is fetched using a linq to sql context
class and its containing object, so each parent form should pass the
required context class to the lookup form. I tried the approach of
sending the datacontext and recordobject class string names to the
lookup form constructor

So this specific tblRole query:
ExampleProject.Database.RoleDataContext _db = new
ExampleProject.Database.RoleDataContext();
var RoleList =
from Role in
_db.GetTable<ExampleProject.Database.tblRole>()
select new { Role.RoleID, Rol.RoleDescription };

Should be something generic like

[?contextObject?] _db = new [?contextObject?] ();
var ObjectList =
from MyObject in _db.GetTable<[?recordObject?]>()
select new { MyObject.[?MyObjectID?], Object.[?
MyObjectDescription?]};
The ID and Description are always tablenameID and
tablenameDescription. In fact all the supporting tables approached by
the lookup form will have the same structure.
The data is then presented in a grid, where the ID is returned to the
parent when the user selects a record.

So two questions:
1 Am I on the right track here, or is this not a viable solution
(passing the stringname of the context/recordobject)
2 How can it be done (example code would be very much appreciated ;)

regards,
Alex

Jul 16 '08 #1
0 1194

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Matt | last post by:
In ASP, when we pass data between pages, we usually pass by query string. If we pass data by query string, that means we need to use submit button, not by regular button, and the form will pass to...
5
by: Belinda | last post by:
Hello All I have the following test.asp page which needs one parameter querystr but my querystr is a very long string value. When I send a long value the query string is getting truncated after...
2
by: Nguyen Xuan Hoang | last post by:
In VB6, There is CallByName function, in .NET there are Activator.CreateInstance but it requires a Type instead of a string name of type. Function Activator.CreateInstance(Type) as Object There...
9
by: Joel Finkel | last post by:
Is there a way to execute a method if all we know is its name as a string? Let's say we have the following class. What is the code for the Execute method? I need a solution that works with the...
2
by: sastry.m.s | last post by:
Hi, I have tables created in my DB2 database created under a schema. Now i want to get connected to these tables with a username different from this schema name from my java application. When...
4
by: Dave | last post by:
If I have a string field that contains the name of a User Control, how could I access the User Control? I need something like the following function: dim ucUC as UserControl Dim strUC as string...
6
by: Rico | last post by:
Hello, I'm looking for a way to reference the string name of an enumerator. I know in VB.net you can do "MyEnum.ToString" and get the name instead of the integer value. Is there a way I can do...
1
by: archana | last post by:
Hi, While checking performance of ASP.NET Application using Perfmon tool, I observed different performance objects for ASP.NET like ASP.NET v2.0.50727, ASP.NET v1.1.4322, and ASP.NET. What is...
4
by: =?Utf-8?B?Tmljaw==?= | last post by:
Hello, I'm using LINQ to access a SQL Server database. The user needs to be able to duplicate a record. Is there an easy way to do this? I rather not have to set each property from one to the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.