Hello,
I can update a dataset from my client app using a dataAdapter.Upd atecommand
when I add parameter values outside of the param declaration. But If I add
the param values inline with the param delcaration, then I have to invoke the
update operation twice - by leaving the updated row - returning to the row
and re-invoking the update procedure. Is there something else I need to do
to add param values inline with the param declaration?
param values added outside of param declaration - works OK:
Private Sub Button4_Click(. ..) Handles Button4.Click
Dim daU As New SqlDataAdapter
daU.UpdateComma nd = New SqlCommand
daU.UpdateComma nd.Connection = conn
daU.UpdateComma nd.Parameters.A dd(New SqlParameter("@ p0", SqlDbType.Int))
daU.UpdateComma nd.Parameters.A dd(New SqlParameter("@ p1", SqlDbType.VarCh ar,
50))
daU.UpdateComma nd.CommandText = "Update tbl1 set tName = @p1 Where tID = @p0"
daU.UpdateComma nd.Parameters(" @p0").Value = txtID.Text
daU.UpdateComma nd.Parameters(" @p1").Value = txtTname.Text
daU.Update(ds, "tbl1")
End Sub
-----------------------------------------------------------------------------
param values added inline with param declaration - have to invoke twice to
get update - must leave row first and then return:
Private Sub Button4_Click(. ..) Handles Button4.Click
Dim daU As New SqlDataAdapter
daU.UpdateComma nd = New SqlCommand
daU.UpdateComma nd.Connection = conn
daU.UpdateComma nd.Parameters.A dd(New SqlParameter("@ p0", SqlDbType.Int, 4,
"ID" ))
daU.UpdateComma nd.Parameters.A dd(New SqlParameter("@ p1", SqlDbType.VarCh ar,
50, "tName"))
daU.UpdateComma nd.CommandText = "Update tbl1 set tName = @p1 Where tID = @p0"
daU.Update(ds, "tbl1")
End Sub
--------------------------------------------------------------------------
Is there something else I need to do to Way2 to make it work when adding
param values inline with the param declaration?
Thanks,
Rich
I can update a dataset from my client app using a dataAdapter.Upd atecommand
when I add parameter values outside of the param declaration. But If I add
the param values inline with the param delcaration, then I have to invoke the
update operation twice - by leaving the updated row - returning to the row
and re-invoking the update procedure. Is there something else I need to do
to add param values inline with the param declaration?
param values added outside of param declaration - works OK:
Private Sub Button4_Click(. ..) Handles Button4.Click
Dim daU As New SqlDataAdapter
daU.UpdateComma nd = New SqlCommand
daU.UpdateComma nd.Connection = conn
daU.UpdateComma nd.Parameters.A dd(New SqlParameter("@ p0", SqlDbType.Int))
daU.UpdateComma nd.Parameters.A dd(New SqlParameter("@ p1", SqlDbType.VarCh ar,
50))
daU.UpdateComma nd.CommandText = "Update tbl1 set tName = @p1 Where tID = @p0"
daU.UpdateComma nd.Parameters(" @p0").Value = txtID.Text
daU.UpdateComma nd.Parameters(" @p1").Value = txtTname.Text
daU.Update(ds, "tbl1")
End Sub
-----------------------------------------------------------------------------
param values added inline with param declaration - have to invoke twice to
get update - must leave row first and then return:
Private Sub Button4_Click(. ..) Handles Button4.Click
Dim daU As New SqlDataAdapter
daU.UpdateComma nd = New SqlCommand
daU.UpdateComma nd.Connection = conn
daU.UpdateComma nd.Parameters.A dd(New SqlParameter("@ p0", SqlDbType.Int, 4,
"ID" ))
daU.UpdateComma nd.Parameters.A dd(New SqlParameter("@ p1", SqlDbType.VarCh ar,
50, "tName"))
daU.UpdateComma nd.CommandText = "Update tbl1 set tName = @p1 Where tID = @p0"
daU.Update(ds, "tbl1")
End Sub
--------------------------------------------------------------------------
Is there something else I need to do to Way2 to make it work when adding
param values inline with the param declaration?
Thanks,
Rich
Comment