objRS.AddNew or SQL Insert, etc?

Results 1 to 3 of 3

Thread: objRS.AddNew or SQL Insert, etc?

  1. #1
    Join Date
    Dec 1969

    Default objRS.AddNew or SQL Insert, etc?

    I love this book! This may be a stupid question but I am going to ask it. What is the best way to decide whether to use ADO or SQL to add or edit info in a database? I am one of those people who craves consistancy and this is driving me nuts. Is it better to use SQL for everything, or (as it is done in this book) is there an advantage to using ADO in some/all instances? And how could you use ADO to work with things like Inner Joins, etc? This is mainly Access based but I would like to have an answer with respect to MSSQL as well (may as well get the right habits for both).<BR><BR>I know this is showing my lack of knowledge, but I really have searched for an answer and the opinions are few. Thanks for any pointers at all. <BR><BR>David

  2. #2
    Join Date
    Dec 1969

    Default Well....

    I think it is an issue of personal preference. Personally, I prefer using SQL strings for *everything* because I like SQL, I am comfortable with the syntax, etc. Those who have come from a DAO background and have used the .AddNew/.Update/.Delete terminology prefer the ADO approach. I think SQL is cool because you can do things like update a ton of rows at once, like:<BR><BR>UPDATE tblUsers SET UserRatings = 5<BR><BR>(that will affect EVERY row in the tblUsers table... with ADO you would need to loop through each record, make the change, and then save it back... ugly and inefficient...)<BR><BR>However, many would argue the .AddNew syntax is a lot cleaner than building a dynamic SQL string based on a user&#039;s form input, with all of the apostrphes/double quotes/double apostrophe crap going on.<BR><BR>I encourage you to learn the SQL way - I think it is more powerful in the end, however the ADO way is likely easier to learn.<BR><BR>Happy Programming!

  3. #3
    Join Date
    Dec 1969

    Default RE: Well....

    You could also use HGB - It&#039;s a new tool that is reall picking up because it&#039;s more powerful than even SQL when it comes to database management - u can concatenate tables, merge different kinds of tables, loads of things like that. www.hgbtutorial.com can get u started<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