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

-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top