TheBugSlayer
Programmer
Hi all.
I have a C# code that does this:
I would like to translate the one line that uses generics and expression trees to VB.NET. This is as far as I am getting
The syntax is not OK but I don't know how to fix it in this verbose VB.NET language...
Your help is appreciated.
MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA)
I have a C# code that does this:
Code:
using (TContext dc = new TContext())
{
dc.CommandTimeout = this.CommandTimeout;
var result = dc.GetTable<TData>().Where<TData>(criteria).SingleOrDefault();
if (result == null)
SetNew();
else
Load(result);
}
Code:
Public Sub ExecuteQuery(ByVal critera As Expression(Of Func(Of TData, Boolean)))
Try
Dim tbl As Table(Of TData)
Using dc As TContext = New TContext()
dc.CommandTimeout = 60
Dim result = dc.GetTable(Of TData)().Where(Of TData)(criteria).SingleOrDefault()
End Using
Catch ex As Exception
End Try
End Sub
Your help is appreciated.
MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA)