A
alee via DotNetMonster.com
Hello,
I am trying to convert a program from Microsoft VB.NET team:
http://blogs.msdn.com/vbteam/archive/2005/04/14/TableAdaptersAndObjects.aspx
I am having a hard time converting the following two sections. Anyone knows
the C# equivalent?
- oringial VB.NET code from VB Team:
Public Sub AcceptChanges()
For Each item As T In Me.Items
item.ObjectState = ObjectState.Unchanged
Next
DeletedRows.Clear()
End Sub
- my approach:
public void AcceptChanges()
{
foreach (T item in this.Items)
{
item.ObjectState = ObjectState.Unchanged;
}
DeletedRows.Clear();
}
- Visusal Studio error: 'T' does not contain a definition for 'ObjectState'
2. Original code from VB team:
Dim txScope As New System.Transactions.TransactionScope
Using txScope
...
end using
- my approach:
using txScope
{
...
}
- Visual Studio:
Syntax error, '(' expected
Best regards,
Alan L.
I am trying to convert a program from Microsoft VB.NET team:
http://blogs.msdn.com/vbteam/archive/2005/04/14/TableAdaptersAndObjects.aspx
I am having a hard time converting the following two sections. Anyone knows
the C# equivalent?
- oringial VB.NET code from VB Team:
Public Sub AcceptChanges()
For Each item As T In Me.Items
item.ObjectState = ObjectState.Unchanged
Next
DeletedRows.Clear()
End Sub
- my approach:
public void AcceptChanges()
{
foreach (T item in this.Items)
{
item.ObjectState = ObjectState.Unchanged;
}
DeletedRows.Clear();
}
- Visusal Studio error: 'T' does not contain a definition for 'ObjectState'
2. Original code from VB team:
Dim txScope As New System.Transactions.TransactionScope
Using txScope
...
end using
- my approach:
using txScope
{
...
}
- Visual Studio:
Syntax error, '(' expected
Best regards,
Alan L.