How to insert multimple records into database at t

Results 1 to 2 of 2

Thread: How to insert multimple records into database at t

  1. #1
    Join Date
    Dec 1969

    Default How to insert multimple records into database at t

    Can any body tell me the best procedure to add multiple records in the same time into the database table. <BR><BR>Here is my problem description: <BR><BR>I need to upload all the records which are displayed in the datagrid. <BR>the datagrid is populated from the comma delimited file. I don&#039;t want loop the database to insert my data into database. <BR><BR>I have tried with OledbDataAdapter.Update(DataSet) method, but i am not able to insert them. I am not using the OledbDataAdapter.Fill(DataSet) method, because i have data in my hand(from comma delimited file), with the same structure. i am getting the following error. <BR><BR>Update unable to find TableMapping[&#039;Table&#039;] or DataTable &#039;Table&#039;.... <BR><BR>Here is my code: <BR><BR>Dim dataAdapter As OracleDataAdapter = New OracleDataAdapter() <BR>dataAdapter.InsertCommand = New OracleCommand("insert into myTable(ID,Name,Address) values (?,?,?)", conn) <BR>dataAdapter.InsertCommand.Parameters.Add(New OracleParameter("ID", OracleType.Number, 10)) <BR>dataAdapter.InsertCommand.Parameters.Add(New OracleParameter("Name", OracleType.VarChar, 20)) <BR>dataAdapter.InsertCommand.Parameters.Add(New OracleParameter("Address", OracleType.VarChar, 20)) <BR>daParcel.Update(ds) <BR><BR>Any help is appreaciated... <BR><BR>Thanks, <BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: How to insert multimple records into database

    Here is a sample of what I did with SQL:<BR><BR>&#039;loop throuh the DG to get all of the quantities<BR> Dim dgItem As DataGridItem<BR> Dim dgItemQty<BR> For Each dgItem In dgItemSearch.Items<BR> dgItemQty = CType(dgItem.FindControl("txtItemSearchQty"), TextBox).Text<BR><BR>&#039;Run your Update Query<BR>Next<BR><BR><BR>hth<BR>David

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts