Results 1 to 4 of 4

Thread: Am I right?--ADO and SQL Server

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    China
    Posts
    3

    Unhappy

    Hi all.
    I am a novice at VB and SQL Server.Now I am working around a project accessing SQL server databases via ADO.

    Restricted to the network bandwidth,the minimum data exchange is prefered.

    All my forms share one ADO connection.When manipulating data,I use the "execute" method of the command object instead of using the "AddNew,Delete,Update" method of the RecordSet object.
    Is that the most efficient way?Could you give me any suggestions?

    Thanks in advance.

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    Hi everjoe

    There is nothing programatically wrong with using the connection.execute statment, in fact it can be faster because the server is handling most of the work instead of the user computer. The main problem is when adding or updating string records. As you probably know when using SQL strings in vb you need to use the ' character to enclose so it doesn't interfere with vb's ", That's all fine and dandy as long as the string you are inserting doesn't have a ' in it. if it did you would get the following output

    strSQL = "UPDATE test SET mystring = 'doesn't'"
    which would obviously fail.

    So as long as you take that into account in your code, there isn't anything worng with doing this.

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303
    Thats the way I tend to use it to, as I've monitored the resources being used by the PC when using these methods and it doesn't use as much as using the Addnew, etc.

    One thing you could also make use of is the Data Enviroment as it makes accessing your Tables, etc easier.
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    China
    Posts
    3
    Thank you for your kindness,Lanpbaker and Parkes.
    All your suggestions benefit me greatly.
    I have little chance to deal with strings with the ' characters in them.So,as you have mentioned,using the Execute method and SQL statements to add and update and delete data is not a hard way.
    I have never used the Data Enviroment.I will take a look at it.
    Thank you again.

    [Edited by everjoe on 08-08-2000 at 11:57 AM]

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