DataSet update with Web Services

S

Steve

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top