DataSet update with Web Services

Discussion in 'ASP .Net Web Services' started by Steve, Nov 11, 2004.

  1. Steve

    Steve Guest

    Hi,

    This is what my problem is right now...I used to do the SQL update in
    a long and bad way... I am wondering who can leads me to a better way
    to improve it by using TableMapping and Update.

    Here's a simple structure of my table in my dataset(dsTemp)..

    UserID - integer(unique key)
    LastName - string
    FirstName - string
    Email - string
    Phone - string

    I used to apply the SQLDataAdapter to insert information into the
    database by sending each item LINE by LINE from the server
    like..(assuming I have a datadapter called da_user_select)

    da_user_select.updateCommand.parameters.item(1).value =
    tbusername.text
    da_user_select.updateCommand.parameters.item(2).value =
    tblastname.text
    da_user_select.updateCommand.parameters.item(3).value =
    tbfirstname.text
    da_user_select.updateCommand.parameters.item(4).value = tbemail.text
    da_user_select.updateCommand.parameters.item(5).value = tbphone.text

    <SQL open>
    Try
    da_user_select.updateCommand.ExecuteNonQuery
    Catch ex as Exception
    throw ex
    End Try
    <SQL close>


    everything works fine here... but I am trying to learn a better way to
    do it by using Web Services. I know that I need to put these
    information into the dataset and send them thru the WebService,
    however, when the Web Service receives the dataset, I wasn't able to
    update the information....here's something that I want to do, please
    modify and let me know what the problem is..

    <WebMethod()> Public Function fcnReturn_updateOK(ByVal dsSet As
    DataSet) As String
    Dim sResult As String
    Dim drr As DataRow()


    ' here i just try to select all rows from the dataset I sent from the
    server, any better way to modify this?

    drr = dsSet.Tables("sp_user_select").Select("")

    ' Do I need something like tablemapping here?

    Me.SqlConnection1.Open()
    Try

    ' this is the only line i put here to update, I think there should be
    a better way to use this without assigning parameter one by one, but I
    am not sure how to do this, please help

    Me.da_instructor_select.Update(drr)
    Catch ex As Exception
    return ex.message
    End Try
    Me.SqlConnection1.Close()
    Return "OK"
    End Function



    I am trying to simplfy the way that I used to assign paramaters from
    the dataset to the dataadapter, what is the best method? Thanks a
    lot!!!! Hope my codes are "understandable".


    Poshi
    Steve, Nov 11, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nick
    Replies:
    1
    Views:
    6,100
    Alvin Bruney - ASP.NET MVP
    Sep 12, 2005
  2. Anup
    Replies:
    1
    Views:
    2,761
    Mark Rae
    May 9, 2006
  3. imlakhani

    Web Services Restful Services

    imlakhani, Dec 16, 2009, in forum: Java
    Replies:
    1
    Views:
    410
    Jeffrey H. Coffield
    Dec 16, 2009
  4. va
    Replies:
    0
    Views:
    142
  5. John
    Replies:
    4
    Views:
    412
Loading...

Share This Page