| | |
how to insert data from dataset into database
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Feb 2007
Posts: 1
Reputation:
Solved Threads: 0
Hi,
I have a requirement to insert data from dataset into a table in the database. Actually i have records in the excel sheet that has to be inserted into the database. I have populated them in a dataset. Now this dataset has to be validated against some conditions. After accepting the changes in the dataset . This table in the database has no records. Records in the dataset have to be inserted to that table. i dont know how to insert all the records in the dataset at one go... Please advice.
Thanks
I have a requirement to insert data from dataset into a table in the database. Actually i have records in the excel sheet that has to be inserted into the database. I have populated them in a dataset. Now this dataset has to be validated against some conditions. After accepting the changes in the dataset . This table in the database has no records. Records in the dataset have to be inserted to that table. i dont know how to insert all the records in the dataset at one go... Please advice.
Thanks
•
•
Join Date: Feb 2007
Posts: 4
Reputation:
Solved Threads: 0
Hello there: I have used this code in my application and it works. It is about populating the database with the information within a present form
I do hope this can help you.
Dim a As String = Me.ComboBox1.SelectedItem Dim b As Integer = Me.txtDeel1.Text Dim c As Integer = Me.txtDeel2.Text Try selectStr = "SELECT TbStukIDRegCD,TbStukIDDeel1,TbStukIDDeel2,TbStukCodeAanbieder," + _ "TbStukTijdInschrijving, TbStukCodeRectificatie, TbStukDatumVerlijden,TbStukAardStuk,TbStukDatumDoorhalingStuk," + _ "TbStukIndGeheelVerwerkt,TbStukReferentie,TbStukBedrag,TbStukCodeMeten,TbStukStukTekst FROM TbStuk" da = New SqlDataAdapter(selectStr, conn) da.Fill(Ds1, "TbStuk") Dim TbStukRow As DataRow = Ds1.Tables("TbStuk").NewRow ''TbStukRow("TbStukDatumID") = Me.tdpdatum.Text TbStukRow("TbStukIDRegCD") = Me.ComboBox1.SelectedItem TbStukRow("TbStukIDDeel1") = Me.txtDeel1.Text TbStukRow("TbStukIDDeel2") = Me.txtDeel2.Text TbStukRow("TbStukCodeAanbieder") = Me.TextBox7.Text TbStukRow("TbStukTijdInschrijving") = Me.TextBox6.Text TbStukRow("TbStukCodeRectificatie") = Me.TextBox5.Text TbStukRow("TbStukDatumVerlijden") = Me.DateTimePicker1.Text TbStukRow("TbStukAardStuk") = Me.TextBox3.Text TbStukRow("TbStukDatumDoorhalingStuk") = Me.DateTimePicker2.Text TbStukRow("TbStukIndGeheelVerwerkt") = Me.TextBox1.Text TbStukRow("TbStukReferentie") = Me.TextBox11.Text TbStukRow("TbStukBedrag") = Me.TextBox10.Text TbStukRow("TbStukCodeMeten") = Me.TextBox9.Text TbStukRow("TbStukStukTekst") = Me.TextBox2.Text Ds1.Tables("TbStuk").Rows.Add(TbStukRow) Dim cmd As New SqlCommandBuilder(da) da.Update(Ds1, "TbStuk") 'conn.Close() Catch Finally MessageBox.Show("successfully inserted into database", "success info", MessageBoxButtons.OK, MessageBoxIcon.Information) End Try
I do hope this can help you.
Use have to use the SqlCommandBuilder to update the table in a database through dataset
Use this it may help:
Use this it may help:
VB.NET Syntax (Toggle Plain Text)
Dim object name as SqlCommandBuilder(DataAdapter's Name) DataAdapter's Name.Update(Datasetname, "Table Name")
There is just two ways to live your life.
One is as though nothing is a miracle.
The other is as if everything is.
One is as though nothing is a miracle.
The other is as if everything is.
![]() |
Similar Threads
- How to insert data into database? (JSP)
- a blank form to insert data???? (Visual Basic 4 / 5 / 6)
- How to insert data into a db (Java)
- Extracting data from large SINGLE-table database to MULT-table relational database (MySQL)
- Insert Data in to Db from the Dynamic Rows (HTML and CSS)
- Unable to insert data into database. (MySQL)
- passing mulitple parameters from jsp to a database (JSP)
Other Threads in the VB.NET Forum
- Previous Thread: How to store multiple selection?
- Next Thread: Can u add Opacity to a PictureBox in VS 2003
| Thread Tools | Search this Thread |
.net .net2008 2008 access account add advanced application array basic beginner browser button buttons click code combo cpu cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic employees excel exists fade filter forms generatetags html images input intel internet listview mobile module monitor mysql net number objects open panel pdf picturebox picturebox2 port position print printing printpreview problem regex reuse right-to-left save search searchvb.net select serial settings shutdown socket sqldatbase sqlserver storedprocedure survey temperature textbox timer timespan transparency txttoxmlconverter update user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vba vbnet vista visual visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year





