473,382 Members | 1,225 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Creating a new row and edit a row

I am banging my head agaisnt the wall, how do I add a new row and edit a
row?
Below is the code I am trying to use, it keeps throwing an exception abount
no insert command. Any ideas about this?
thnks
Dim mDBN As String = "C:\BNM.MDB"

Dim cCON As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mDBN
& ";Persist Security Info = False"

Dim mSQL As String = "SELECT * FROM Numbers"

Dim cn As New OleDb.OleDbConnection(cCON)

Dim DA As New OleDb.OleDbDataAdapter(mSQL, cn)

Dim DS As New DataSet

DA.FillSchema(DS, SchemaType.Source, "Numbers")

DA.Fill(DS, "Numbers")

Dim CBA As New OleDb.OleDbCommandBuilder(DA)

DA.UpdateCommand = CBA.GetUpdateCommand

Dim DT As New DataTable

DT = DS.Tables("Numbers")

Dim DR As DataRow

DR = DS.Tables("Numbers").NewRow

DR.BeginEdit()

DR("Number") = "OKAY DOO"

DR.EndEdit()

DS.Tables("Numbers").Rows.Add(DR)

DA.Update(DS, "Numbers")
Nov 16 '06 #1
1 1020
heres the exact error message;
it happens as son as I call update
ErrorCode=-2147217900
Message="Syntax error in INSERT INTO statement."

"Warex" <Ig************@juno.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>I am banging my head agaisnt the wall, how do I add a new row and edit a
row?
Below is the code I am trying to use, it keeps throwing an exception
abount no insert command. Any ideas about this?
thnks
Dim mDBN As String = "C:\BNM.MDB"

Dim cCON As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
mDBN & ";Persist Security Info = False"

Dim mSQL As String = "SELECT * FROM Numbers"

Dim cn As New OleDb.OleDbConnection(cCON)

Dim DA As New OleDb.OleDbDataAdapter(mSQL, cn)

Dim DS As New DataSet

DA.FillSchema(DS, SchemaType.Source, "Numbers")

DA.Fill(DS, "Numbers")

Dim CBA As New OleDb.OleDbCommandBuilder(DA)

DA.UpdateCommand = CBA.GetUpdateCommand

Dim DT As New DataTable

DT = DS.Tables("Numbers")

Dim DR As DataRow

DR = DS.Tables("Numbers").NewRow

DR.BeginEdit()

DR("Number") = "OKAY DOO"

DR.EndEdit()

DS.Tables("Numbers").Rows.Add(DR)

DA.Update(DS, "Numbers")


Nov 16 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Iain Miller | last post by:
Now this shouldn't be hard but I've been struggling on the best way as to how to do this one for a day or 3 so I thought I'd ask the assembled company..... I'm writing an application that tracks...
4
by: Filippo Pandiani | last post by:
I have a grid that shows the file list from a folder. On the postback, how do I get a Dataset from this grid? Thanks, Filippo.
4
by: Martin | last post by:
I want to build a data entry form for creating and updating info on something. When I'm first creating an item all the fields need to be editable. There after some fields become readonly. Most...
0
by: .nu | last post by:
#!/usr/bin/env python # -*- coding: utf-8 -*- # Name: Sleepy Hollow # Author: .nu import wx import os import sys
0
by: lianaent | last post by:
Hi All, I'm brand new to asp.net 2.0, and have a simple task of just creating a quick and dirty data entry form with SQL Server 2005 on the back end. I added a gridview to my form, and I can...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.