By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,996 Members | 896 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,996 IT Pros & Developers. It's quick & easy.

Add new Rows

P: 2
Expand|Select|Wrap|Line Numbers
  1. Dim conn As New OleDbConnection("provider=Microsoft.ACE.OLEDB.12.0; data source = " & msPath & "Database1.accdb;")
  2. Dim dt As New DataTable()
  3. Dim sSql As String = "SELECT * FROM Table1"
  4. Dim da As New OleDb.OleDbDataAdapter(sSql, conn)
  5. Dim iChange As Integer
  6. da.Fill(dt)
  7. For iLoop As Integer = 0 To lstN.Count - 1
  8.     Dim row As DataRow = dt.NewRow
  9.     row("Draw") = lstN.Item(iLoop)
  10.     row("Character") = lstC(iLoop)
  11.     dt.Rows.Add(row)
  12. Next
  13.  
  14. 'Here is the Question:
  15. 'An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll
  16.  
  17. iChange = da.Update(dt)
  18.  
  19. 'Syntax error in INSERT INTO statement
  20.  
  21. conn.Close()
thanks for help
Jul 13 '15 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.