Results 1 to 5 of 5

Thread: which is faster for adding records?

  1. #1

    Thread Starter
    Hyperactive Member gmatteson's Avatar
    Join Date
    Feb 2002
    Location
    Rhode Island, USA
    Posts
    293

    which is faster for adding records?

    using a datarow object or regular sql syntax such as..

    Dim oCmdInsertSchool As New MySqlCommand("insert into school (name , db, host) values('" & txtSchool.Text & "', '" & txtDB.Text & "', '" & txtHost.Text & "')", oConn)
    oCmdInsertSchool.ExecuteNonQuery()

    rather than
    dim orow as datarow

    orow.items("name") = txtschool.text

    thanks

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    It depends if how often/when you are updating the database or how many rows you are changing. If you want to change 10 rows in a row then a dataset and the second way would be faster than calling an update for each row. Also if you want to only update the database at selected times, in a delayed fashion, then the 2nd way could be faster but if you want to update immediately then go the first route.

  3. #3
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    Call a stored procedure and pass it the values needed.
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Originally posted by Memnoch1207
    Call a stored procedure and pass it the values needed.
    Fastest way.

  5. #5
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612
    Could someone please post an example of a stored procedure that adds a new record to a database.

    Thanks
    David Wilhelm

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