Simple C# question

  • Thread starter Thread starter dot Net Pa Ji
  • Start date Start date
D

dot Net Pa Ji

In VB.Net, Lines between A and B can be replaced with Lines between C and D
is there something in C# like this (With... End With) ??

---Line A------------------------------------------------------------
--vb.net code
objCMD.CommandText = "select * from ..."
objCMD..CommandType = CommandType.Text
...... ............... .............. ................. ...................
...... ............... .............. ................. ...................

---Line B------------------------------------------------------------

---Line C------------------------------------------------------------
--vb.net code
With objCMD
.CommandText = "select COUNT(*) from Customers WHERE COUNTRY=
@COUNTRY AND CITY = @CITY"
.CommandType = CommandType.Text
....
.....
End With

---Line D------------------------------------------------------------

--C# code
objCMD.CommandText ="select * from ";

objCMD.CommandType = CommandType.Text;





Thanks in advance

-----
 
No.

In VB.Net, Lines between A and B can be replaced with Lines between C and D
is there something in C# like this (With... End With) ??

---Line A------------------------------------------------------------
--vb.net code
objCMD.CommandText = "select * from ..."
objCMD..CommandType = CommandType.Text
...... ............... .............. ................. ...................
...... ............... .............. ................. ...................

---Line B------------------------------------------------------------

---Line C------------------------------------------------------------
--vb.net code
With objCMD
.CommandText = "select COUNT(*) from Customers WHERE COUNTRY=
@COUNTRY AND CITY = @CITY"
.CommandType = CommandType.Text
....
.....
End With

---Line D------------------------------------------------------------

--C# code
objCMD.CommandText ="select * from ";

objCMD.CommandType = CommandType.Text;





Thanks in advance

-----
 
Back
Top