I need your help to resolve this issue.
How to pass table name dynamically in linq to sql in C#.net?
public IntPol(DataClasses1DataContext DC, decimal value,string tableName)
{
}
tableName
will change dynamically.
I need your help to resolve this issue.
How to pass table name dynamically in linq to sql in C#.net?
public IntPol(DataClasses1DataContext DC, decimal value,string tableName)
{
}
tableName
will change dynamically.
I don't believe this is going to be possible. At least not using traditional Ling-To-SQL. You could use the L2S Connection object, hard code a T-SQL statement, and pass that to SQL Server. But, in this case, you aren't really using L2S anymore.
If I understand the question correctly then you could do something like
public IntPol(DataClasses1DataContext DC, decimal value,string tableName)
{
DC = new DataClasses1DataContext("yourConnString");
var result = DC.Mapping.GetTables().SingleOrDefault(t => t.TableName.ToString() == tableName);
}
Or you could also do tableObject.GetType().Name
but if type is dynamic might have to send Type tableType
separately.