|
-
Mar 4th, 2002, 07:47 AM
#1
Thread Starter
Addicted Member
Converting a reader (VB.NET)
I populated a data reader and was wondering how to move it to a dataset, so I can make changes and write it back to the database.
Maybe I should have put it in a dataset in the first place. Any help would be appreciated.
-
Mar 4th, 2002, 09:29 AM
#2
maybe this..not 100% sure
myDataReader.Fill(myDataSet, "Table name")
-
Mar 4th, 2002, 09:53 AM
#3
if you need to convert a datareader into a dataset then you need to rework your app. those were developed for two separate purposes(the DataReader for very high speed readonly data access and the other for very rich disconnected data access). if you need to update data either fill up a dataset right from the go(fyi, the DataAdapter has the .Fill method not the DataReader) or: query the db using the reader, take out the items you need to update(probably assign them to local variables or something), lose the DataReader(cuz it's readonly), do whatever you want to the local variables, then create a command object and manually build your update sql statement writing in the params using the local variables for the values.
-
Mar 4th, 2002, 10:40 AM
#4
Thread Starter
Addicted Member
Is this correct when utilizing a stored Proc
Is this correct for using a stored procedure
Public Sub PopulateMainTable(ByVal strConnect As String)
Dim cn As OleDbConnection = New OleDbConnection(strConnect)
Dim cmd As OleDbCommand = New OleDbCommand("spTapeCaliperEmp", cn)
cmd.CommandType = CommandType.StoredProcedure
cn.Open()
Dim da As OleDbDataAdapter = New OleDbDataAdapter()
da.SelectCommand = cmd
Dim ds As DataSet = New DataSet()
da.Fill(ds, "spTapeCaliperEmp")
'WriteMainData(myReader, strConnect)
cn.Close()
end sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|