PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft VB .NET
Creating a new row and edit a row
Forums
Newsgroups
Microsoft DotNet
Microsoft VB .NET
Creating a new row and edit a row
![]() |
Creating a new row and edit a row |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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") |
|
|
|
#2 |
|
Guest
Posts: n/a
|
heres the exact error message;
it happens as son as I call update ErrorCode=-2147217900 Message="Syntax error in INSERT INTO statement." "Warex" <Igiveitallaway@juno.com> wrote in message news:%23d9pt7RCHHA.3396@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") > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

