|
I am using the Query Builder in Visual Studio to fill my Dataset but one of the field/column names is unknown until runtime; therefore I wish to specify this on the fly.
My current query is as follows:
SELECT Cards.Id, Cards.Card, Cards.FirstName, Cards.LastName, Cards.AccessLevel, Cards.StartDate, Cards.EndDate, Cards.fTitle, ?,<br />
Photo.Id AS Expr1, Photo.Photo,<br />
AccLevel.AccessLevel AS Expr2, AccLevel.Name AS AccessName<br />
<br />
FROM (Cards<br />
LEFT JOIN Photo ON<br />
Cards.Card = Photo.Id)<br />
LEFT JOIN AccLevel ON<br />
Cards.AccessLevel = AccLevel.AccessLevel
The question mark represents a variable field name. Below is the code which fills the dataset by calling the query above - although for now, I have passed it a fixed string which represents one of the fields in the ‘Cards’ table and should replace the question mark in the query:
cards_Photo_AccessLevelTableAdapter.Fill(MyDataSet.Cards_Photo_AccessLevel, "Cards.fDepartment");
Although my code builds ok, an exception is caused when the Dataset is filled as above.
Any help would be much appreciated!!
Regards,
Christian
|
|
|
|