Results 1 to 3 of 3

Thread: Fastest way to connect to SQL

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2008
    Posts
    47

    Thumbs up Fastest way to connect to SQL

    Hi,

    I am a beginner in database programming. As I am researching, I saw many ways of using ADODB. But I just want to know what is the best way to connect to SQL server. Currently I am using this way:

    Set cm = new adodb.command
    Set cm.ActiveConnection = cn
    cm.CommandText = "sp_GetUsers"
    cm.CommandType = adCmdStorProc
    cm(0).Direction = adParamReturnValue
    cm(1).Value = txtId
    cm(2).Value = txtGroup
    Set rs = cm.Execute

    Everytime I am getting something or querying something from database, I run such kind of code this way. Is this applicable for corporate use if I want to make my program run fast?

    Thanks

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Fastest way to connect to SQL

    The code you have shown is fine, and not just in terms of speed - it will be safer than the alternatives too (as the values from the textboxes are treated as values, rather than potentially being treated as part of the SQL code by mistake).

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2008
    Posts
    47

    Re: Fastest way to connect to SQL

    Thanks very much for the tip..

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width