code review

Results 1 to 3 of 3

Thread: code review

  1. #1
    Join Date
    Dec 1969

    Default code review

    can any kind soul(s) review the following code & comment , & if its not optimal suggest improvements. i&#039;m re-using the connection object & also the variable. it works fine but the books i&#039;ve read don&#039;t do this, so i just wanted to check up.<BR><BR>sql = "select count(*) from table"<BR>cnn.execute (sql)<BR>....<BR>....<BR>.....<BR>sql="select * from table"<BR>cnn.execute(sql2) <BR>...<BR>cnn.close<BR>...<BR>

  2. #2
    Join Date
    Dec 1969

    Default One Improvement

    sql = "select count(MyFieldId) from table" <BR><BR>And also, select only the fields you actually need from the select statement.<BR><BR>Re-using the connection looks ok to me.

  3. #3
    Join Date
    Dec 1969

    Default I didn't read

    anywhere saying using con object to execute multiple queries is bad.Infact, i would say(ofcourse learnt books)<BR><BR>1.If u want to execute same query multiple times use Rs<BR>2.Use Conn to execute diff. queries on diff. contexts<BR><BR>thus u reduce burden on server.<BR><BR>So, No problem for U.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts