DataAdpater Without SqlCommand

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My Busn tier returns a DataSet and I want to fill a DataAdapter in the
presentation layer with that dataset.
Problem is that if I create a DataAdapter in the presentation layer i need
to specify a SqlCommand with it, but i don't want to, i just want to fill it
with the DataSet from the Busn Tier.

Any ideas on how you get round this?
 
Billy,
The general purpose of a DataAdapter is to fil a DataTable or DataSet
(besides updates, etc). So, if you've already got a filled dataset from
somewhere else, you should not need a DataAdapter for anything.
Peter
 
I do need to update the dataset, here is my code if that helps:
I think i maybe trying to go about this the wrong way?

----------------------------
Dim ds As Dataset
Dim da As New SqlDataAdapter

ds = getDataSetFromBusnLayer()

da.Fill(ds, 0)

ds.Tables(0).Rows(objArgs.Item.ItemIndex(0) = "NewValue"

Dim cb As New SqlCommandBuilder(da)
da.UpdateCommand = cb.GetUpdateCommand
da.Update(ds, 0)
 
If i follow your logic correctly, the below code should work, but it throws
me a "The DataAdapter.SelectCommand property needs to be initialized." error?

-----------------------------------
Dim ds As Dataset
ds = getDataSetFromBusnLayer()

Dim da As New SqlDataAdapter
Dim cb1 As New SqlCommandBuilder(da)
da.UpdateCommand = cb1.GetUpdateCommand
da.Update(ds, 0)
 

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

Back
Top