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. Database & SysAdmin
  3. Database
  4. ADO.NET update/select question

ADO.NET update/select question

Scheduled Pinned Locked Moved Database
questioncsharpdatabasecomhelp
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.
  • T Offline
    T Offline
    Tom Wright
    wrote on last edited by
    #1

    I'm modifying a program (oQuery) that I found on this site so that it will allow updates too. My problem is how do I do an update using some generic query execution. My problem comes up when I try and get the number of rows returned. So how can I tell that the user just did an update and then find out how many rows were affect by that update? mssqlComm.CommandType = CommandType.Text mssqlComm.CommandText = sqlQuery 'this is the query from the user mssqlComm.Connection = mssqlConn mssqlcomm.ExecuteNonQuery() mssqladpt = New SqlDataAdapter(mssqlcomm) mssqlds = New DataSet mssqladpt.fill(mssqlds) Thanks Tom

    Tom Wright tawright915@gmail.com

    P C 2 Replies Last reply
    0
    • T Tom Wright

      I'm modifying a program (oQuery) that I found on this site so that it will allow updates too. My problem is how do I do an update using some generic query execution. My problem comes up when I try and get the number of rows returned. So how can I tell that the user just did an update and then find out how many rows were affect by that update? mssqlComm.CommandType = CommandType.Text mssqlComm.CommandText = sqlQuery 'this is the query from the user mssqlComm.Connection = mssqlConn mssqlcomm.ExecuteNonQuery() mssqladpt = New SqlDataAdapter(mssqlcomm) mssqlds = New DataSet mssqladpt.fill(mssqlds) Thanks Tom

      Tom Wright tawright915@gmail.com

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      ExecuteNonQuery returns an integer value that indicates how many records were affected by the query being executed.

      Paul Marfleet

      1 Reply Last reply
      0
      • T Tom Wright

        I'm modifying a program (oQuery) that I found on this site so that it will allow updates too. My problem is how do I do an update using some generic query execution. My problem comes up when I try and get the number of rows returned. So how can I tell that the user just did an update and then find out how many rows were affect by that update? mssqlComm.CommandType = CommandType.Text mssqlComm.CommandText = sqlQuery 'this is the query from the user mssqlComm.Connection = mssqlConn mssqlcomm.ExecuteNonQuery() mssqladpt = New SqlDataAdapter(mssqlcomm) mssqlds = New DataSet mssqladpt.fill(mssqlds) Thanks Tom

        Tom Wright tawright915@gmail.com

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        Colin must be asleep...

        Tom Wright wrote:

        sqlQuery 'this is the query from the user

        I assume you're parsing this string to check for any kind of SQL injection attack ? Accepting raw SQL and running it blindly is a real recipe for someone to wipe your DB on you.

        Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        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