0

Setting "SET NOCOUNT ON" in an application always benefits the performance of the application. But how i can set it in my vb.net application in a VB.net project? Here are my code

Dim myConn As OleDbConnection
Dim myAdapter As OleDbDataAdapter
Dim myDts As New DataSet
Dim strSql As String = "select * from table_issue"
myConn = New OleDbConnection(oldeb_connection_string)
myAdapter = New OleDbDataAdapter(strSql, myConn)
myAdapter.Fill(myDts,"table_issue")
  • What do you mean by "NOCOUNT ON"? – preciousbetine Dec 25 '18 at 09:27
  • 1
    Possible duplicate of [What is the Oracle equivalent of SQL Server's SET NOCOUNT ON?](https://stackoverflow.com/questions/10720751/what-is-the-oracle-equivalent-of-sql-servers-set-nocount-on) – GolezTrol Dec 25 '18 at 09:36
  • See duplicate question: There is no 'nocount' in Oracle, but there is the similar `set feedback off`. But to me it sounds like the kind of optimization to only use in very specific circumstances. Typically you'd want to know how many rows were affected by your statement, right? Maybe not for selects, but then again, in selecting data and returning it, also returning the count is just little extra overhead. – GolezTrol Dec 25 '18 at 09:36
  • You would save more time by not returning all the columns of the database if you didn't need them, and a DataSet may be overkill for whatever you're doing with the data. Without more information, I can't say if changing either of those would help in that particular program. Before trying to optimise something, you need to measure what is worth the effort of optimisation. – Andrew Morton Dec 25 '18 at 09:51

1 Answers1

-1

Dim strSql As String = "SET NOCOUNT OFF; select * from table_issue; SET NOCOUNT ON;"

Ekha
  • 24
  • 3
  • An explanation, what the posted code does and how this addresses the problem in the question, rarely fails to improve an answer. – MBT Dec 25 '18 at 12:23