Results 1 to 9 of 9

Thread: RE: Transactions in SQl Server

  1. #1

    Thread Starter
    Fanatic Member kaihirst's Avatar
    Join Date
    Jul 2005
    Location
    The Resaurant At the End of The Universe
    Posts
    633

    RE: Transactions in SQl Server

    Hi,

    going to be changing a conente management system that used dynamic queries to transactions within its structure, and would like to ask the following.

    When using the ADO commandset object in Visual Basic, whats best to retrieve these SQl fiels that contain the transction, file or virtual?

    file

    VB Code:
    1. CNNcommandSet = "H:\CMS\QUERIES\T-SQLstoredtrans.sql"

    Or

    VB Code:
    1. CNNcommandSet = Server.MapPath("//Queries/T-SQLstoredProc.sql")

    Any ideas or does anybody have a better way of doing this?

    Ta

    Kai
    Last edited by kaihirst; Jun 22nd, 2006 at 05:34 AM. Reason: incorrect spelling
    As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..

    A few things that make a good Developer a Great One.
    Methodical and a thorough approach to research and design inevitably leads to success.
    Forward thinking is the key to Flow of control.
    Never test in the design environment, always test in real time, you get the REAL results.
    CBSE & OOSE are the same animal, they just require different techniques, and thinking.
    SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them.
    The key to good design is explicit attention to both detail and response.
    Think Freely out of the "Box" you're in..... You will soar to better heights.

    Kai Hirst - MSCE, MCDBA, MCSD, MCP, MCAP, MSCT


  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Transactions in SQl Server

    I have never used a commandset - what's in the .SQL file?

    Do you need to "record" the results of that .SQL file being executed?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3

    Thread Starter
    Fanatic Member kaihirst's Avatar
    Join Date
    Jul 2005
    Location
    The Resaurant At the End of The Universe
    Posts
    633

    Re: Transactions in SQl Server

    Hi.

    I dont currently need to record the results of the SQL command, but the window of development is always an open one, and the topic of this, did com into play at some point, and as a reputable developer, i like my clieents to have some scope for further progress and deveopment when they deal with me, so i may come of this, then again it way not, but recording the statement may be sueful in future.

    Yes you do need a recordset, to which I do have one to retrieve and and display the results.

    whats in the SQL file? SEQUAL of course!!! No really, here is one of the queries. admitedly, you dont have to use a trannsaction, but there is a method behind this reasoning.

    VB Code:
    1. BEGIN TRANSACTION WeddingCardShop
    2. SELECT DISTINCT ProductName AS Product,
    3. Product_Catalogue.ProductHeader AS Header,
    4. Product_Catalogue.ProductSubText AS SubHeader,
    5. Product_Catalogue.Price AS PriceTag,
    6. Product_Catalogue.Tax AS VAT,
    7. Product_Catalogue.Department AS DisplayDept,
    8. Product_Images.Image_1 AS ProductImage,
    9. Product_Images.ALT AS ImageName
    10. FROM Product_Catalogue INNER JOIN Product_Images
    11. ON Product_Catalogue.productID = Product_Images.productID
    12. WHERE Product_Catalogue.Shop = 'wedding'
    13. AND Product_Catalogue.Department = 'Cards'
    14. COMMIT TRANSACTION
    As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..

    A few things that make a good Developer a Great One.
    Methodical and a thorough approach to research and design inevitably leads to success.
    Forward thinking is the key to Flow of control.
    Never test in the design environment, always test in real time, you get the REAL results.
    CBSE & OOSE are the same animal, they just require different techniques, and thinking.
    SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them.
    The key to good design is explicit attention to both detail and response.
    Think Freely out of the "Box" you're in..... You will soar to better heights.

    Kai Hirst - MSCE, MCDBA, MCSD, MCP, MCAP, MSCT


  4. #4
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Transactions in SQl Server

    Interesting...

    So basically you have these queries written into .SQL text files...

    You want to execute them.

    I cannot find COMMANDSET as a valid ADO object or method. What is CNNCommandSet?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  5. #5

    Thread Starter
    Fanatic Member kaihirst's Avatar
    Join Date
    Jul 2005
    Location
    The Resaurant At the End of The Universe
    Posts
    633

    Re: Transactions in SQl Server

    Hi,

    CNNcommandSet is this

    [Highlight=VB]

    set CNNcommandSet = Server.CreateObject("ADODB.Command")

    [Highlight=VB]

    ta

    KAi
    As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..

    A few things that make a good Developer a Great One.
    Methodical and a thorough approach to research and design inevitably leads to success.
    Forward thinking is the key to Flow of control.
    Never test in the design environment, always test in real time, you get the REAL results.
    CBSE & OOSE are the same animal, they just require different techniques, and thinking.
    SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them.
    The key to good design is explicit attention to both detail and response.
    Think Freely out of the "Box" you're in..... You will soar to better heights.

    Kai Hirst - MSCE, MCDBA, MCSD, MCP, MCAP, MSCT


  6. #6
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Transactions in SQl Server

    I have never seen assigning the "command" object to a text file.

    I see in my ADO book stuff about COMMANDSTREAM and ASP pages - but it doesn't look like what you are doing.

    Does this work?

    Help me understand your question better.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  7. #7

    Thread Starter
    Fanatic Member kaihirst's Avatar
    Join Date
    Jul 2005
    Location
    The Resaurant At the End of The Universe
    Posts
    633

    Re: Transactions in SQl Server

    Hi,

    duno whether thsi works or not.. thats what I want to find out and explore prelimenary.

    i would have thought so as you generally assign this attribute

    CNNCommandSet.CommandText = STRING

    of the ADODB.Command object is a string containing SQL, and therefore assigning a file shoudl work within the same context, but nto sure.

    Any thoughts?

    kai
    As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..

    A few things that make a good Developer a Great One.
    Methodical and a thorough approach to research and design inevitably leads to success.
    Forward thinking is the key to Flow of control.
    Never test in the design environment, always test in real time, you get the REAL results.
    CBSE & OOSE are the same animal, they just require different techniques, and thinking.
    SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them.
    The key to good design is explicit attention to both detail and response.
    Think Freely out of the "Box" you're in..... You will soar to better heights.

    Kai Hirst - MSCE, MCDBA, MCSD, MCP, MCAP, MSCT


  8. #8
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Transactions in SQl Server

    kai - I do not think so...

    I think you would have to load the SQL from the file into a string and then put it into the CommandText.

    And at that point I'm not sure it's going to like having multiple commands in the string (I've never done that so I question if it's possible).

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  9. #9
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Transactions in SQl Server

    Look up the SQLDMO object.... If I remember right, there's a method in the Database object that will allow you to load and run SQL scripts from a file.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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