-
July 11th, 2019, 08:34 AM
#1
Typed Datasets
Hello:
I have this very inconsistent code that may be mixing untyped and typed datasets. My goal is to have a typed dataset where I can just say dataset.Update to get any new information or changes.
I have read through several articles and am unable to relate what I am doing to them. I am using a table adapter to update my dataset, have no idea if that is right because every example I look at us using data adapters, which require sql statements. It seems to me that if I already have the dataset available for use, then why would I need a sql statement?
I also would not mind creating an instance of my table adapter rather than referring to it directly, but am concerned this is only for untyped datasets.
My code below also does add rows, because this is the only way I could get it to work. The problem is, the update only happens once this way.
I need to understand the difference between typed and untyped as far as coding is concerned.
Thank you for the help.
Code:
JobSheetDataSet.CaseSensitive = False
Dim ta_JobInfo As JobSheetDataSetTableAdapters.JobInfoTableAdapter = New JobSheetDataSetTableAdapters.JobInfoTableAdapter
ta_JobInfo.Fill(JobSheetDataSet.JobInfo)
Dim JobInfoRow As DataRow = JobSheetDataSet.JobInfo.NewRow
With JobInfoRow
.Item("JobNo") = JobNo
.Item("ProjectItem") = ProjectItem
.Item("DrawingNo") = DrawingNo
.Item("Started") = Started ' date
.Item("Completed") = Completed ' date
.Item("ToProd") = Completed ' date
.Item("Engineer") = Engineer
.Item("Designer") = Designer
.Item("EstHrs") = EstHrs ' decimal
.Item("Checker") = Checker
.Item("EngineeringJobNotes") = EngineeringJobNotes
.Item("ShipTo") = ShipTo
.Item("ShipDate") = ShipDate ' date
.Item("FMLDrawingNo") = FMLDrawingNo
End With
Try
JobSheetDataSet.JobInfo.Rows.Add(JobInfoRow)
Catch
End Try
ta_JobInfo.Update(JobSheetDataSet.JobInfo)
-
July 14th, 2019, 12:13 PM
#2
Re: Typed Datasets
How about taking a look at Entity Framework or Entity Framework Core or some other orm?
-
July 14th, 2019, 05:16 PM
#3
Re: Typed Datasets
Perhaps. Is this what is recommended?
As I understand it, I am supposed to be able to use the typed dataset and table adapter to just update, and this takes my array based source and automatically updates the data tables, one table at a time. There are no sql statements, and it always knows what to do (insert, change or delete) based on the update command.
I have reviewed several books and articles, all of which use references for untyped datasets.
Can you recommend a good reference, or provide clarification? As I understand Entity Framework, it too requires sql statements.
Thank you for your reply.
-
July 14th, 2019, 11:27 PM
#4
Re: Typed Datasets
I would say using an orm like EF is recommended over data sets. If you are using EF properly, it shouldn't require having to write sql (there are exceptions to this, but using the latest EF helps to minimize having to fall back to hand writing SQL).
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
|