Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB.Net and SQL Statements

VB.Net and SQL Statements

Scheduled Pinned Locked Moved Visual Basic
databasecsharp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    directred
    wrote on last edited by
    #1

    I am about to start a new project that requires using SQL statements. Where as before, I concatanated my SQL statements within VB.net, is there a better way of doing this. I read in some articles that this is not good practice. Should I start using stored procedure methods or use string builder. Any user experiance would be appreciated What are the pros and cons of doing it my way or should I start doing it different or just continue as before.

    M J 2 Replies Last reply
    0
    • D directred

      I am about to start a new project that requires using SQL statements. Where as before, I concatanated my SQL statements within VB.net, is there a better way of doing this. I read in some articles that this is not good practice. Should I start using stored procedure methods or use string builder. Any user experiance would be appreciated What are the pros and cons of doing it my way or should I start doing it different or just continue as before.

      M Offline
      M Offline
      mr_lasseter
      wrote on last edited by
      #2

      You should use Procedures. Try googling Parameterized Queries.

      Mike Lasseter

      1 Reply Last reply
      0
      • D directred

        I am about to start a new project that requires using SQL statements. Where as before, I concatanated my SQL statements within VB.net, is there a better way of doing this. I read in some articles that this is not good practice. Should I start using stored procedure methods or use string builder. Any user experiance would be appreciated What are the pros and cons of doing it my way or should I start doing it different or just continue as before.

        J Offline
        J Offline
        James Foxall
        wrote on last edited by
        #3

        Stored procedures are often the best way to go, but you will be limited in how you can create your SQL statements. A stored procedure has to be able to be compiled when saved, which means the compiler needs to know the fields to retrieve/update and the criteria to use when exucuting the procedure. With highly dynamic SQL, this is often not an option. In short, use a stored procedure if possible. Another option is to create SQL views and call those to retrieve data. If you're going to process the views though (i.e. retrieve a subset of data from a view), wrap that code in a stored procedure if possible.

        james commercial developer, author, speaker, dude. www.jamesfoxall.com

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups