|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Updating DatagridviewWhen I go to update my datagridview...I get this error
Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information. using an update button...I have the following code: Dim cm As OleDb.OleDbCommandBuilder = New OleDb.OleDbCommandBuilder(SxAdapter) SxAdapter.Update(CType(SxSource.DataSource, DataTable)) I'm using 2005 Any ideas? Hi,
What is the select command for SxAdapter? Ken -------------------------- Show quoteHide quote "Arne Beruldsen" <ArneBeruld***@discussions.microsoft.com> wrote in message news:1DC63FFD-BC05-4382-A2C1-5CEF25DB0876@microsoft.com... > When I go to update my datagridview...I get this error > > Dynamic SQL generation for the UpdateCommand is not supported against a > SelectCommand that does not return any key column information. > > using an update button...I have the following code: > > Dim cm As OleDb.OleDbCommandBuilder = New > OleDb.OleDbCommandBuilder(SxAdapter) > SxAdapter.Update(CType(SxSource.DataSource, DataTable)) > > I'm using 2005 > > Any ideas? Here is my GetData mod
Private Sub GetData(ByVal selectCommand As String) Try Dim Cxx As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Application.StartupPath & "\zAdmin.mdb;User Id=admin;Password=;" SQL = "Select LastName, FirstName, Date, Score from Scores" ' Create a new data adapter based on the specified query. SxAdapter = New OleDbDataAdapter(SQL, Cxx) Dim MyCommandBuilder As New OleDbCommandBuilder(SxAdapter) Dim SxTable As New DataTable() SxTable.Locale = System.Globalization.CultureInfo.InvariantCulture SxAdapter.Fill(SxTable) SxSource.DataSource = SxTable Catch ex As OleDbException MessageBox.Show("Error") End Try End Sub Show quoteHide quote "Arne Beruldsen" wrote: > When I go to update my datagridview...I get this error > > Dynamic SQL generation for the UpdateCommand is not supported against a > SelectCommand that does not return any key column information. > > using an update button...I have the following code: > > Dim cm As OleDb.OleDbCommandBuilder = New OleDb.OleDbCommandBuilder(SxAdapter) > SxAdapter.Update(CType(SxSource.DataSource, DataTable)) > > I'm using 2005 > > Any ideas? Hi,
I think date is an keyword. Try this for the select statement SQL = "Select LastName, FirstName, [Date], Score from Scores" Ken ------------------ Show quoteHide quote "Arne Beruldsen" <ArneBeruld***@discussions.microsoft.com> wrote in message news:EF3BD3B7-1133-4353-9EB3-F9816ABB7BC7@microsoft.com... > Here is my GetData mod > > Private Sub GetData(ByVal selectCommand As String) > Try > Dim Cxx As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data > Source= " & Application.StartupPath & "\zAdmin.mdb;User > Id=admin;Password=;" > SQL = "Select LastName, FirstName, Date, Score from Scores" > ' Create a new data adapter based on the specified query. > SxAdapter = New OleDbDataAdapter(SQL, Cxx) > Dim MyCommandBuilder As New OleDbCommandBuilder(SxAdapter) > Dim SxTable As New DataTable() > SxTable.Locale = > System.Globalization.CultureInfo.InvariantCulture > SxAdapter.Fill(SxTable) > SxSource.DataSource = SxTable > Catch ex As OleDbException > MessageBox.Show("Error") > End Try > End Sub > > > > "Arne Beruldsen" wrote: > >> When I go to update my datagridview...I get this error >> >> Dynamic SQL generation for the UpdateCommand is not supported against a >> SelectCommand that does not return any key column information. >> >> using an update button...I have the following code: >> >> Dim cm As OleDb.OleDbCommandBuilder = New >> OleDb.OleDbCommandBuilder(SxAdapter) >> SxAdapter.Update(CType(SxSource.DataSource, DataTable)) >> >> I'm using 2005 >> >> Any ideas? Good thought but still didn't work...I even changed the column to
TestDate...still no luck...:( I'm stumped Show quoteHide quote "Ken Tucker [MVP]" wrote: > Hi, > > I think date is an keyword. Try this for the select statement > > SQL = "Select LastName, FirstName, [Date], Score from Scores" > > Ken > ------------------ > "Arne Beruldsen" <ArneBeruld***@discussions.microsoft.com> wrote in message > news:EF3BD3B7-1133-4353-9EB3-F9816ABB7BC7@microsoft.com... > > Here is my GetData mod > > > > Private Sub GetData(ByVal selectCommand As String) > > Try > > Dim Cxx As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data > > Source= " & Application.StartupPath & "\zAdmin.mdb;User > > Id=admin;Password=;" > > SQL = "Select LastName, FirstName, Date, Score from Scores" > > ' Create a new data adapter based on the specified query. > > SxAdapter = New OleDbDataAdapter(SQL, Cxx) > > Dim MyCommandBuilder As New OleDbCommandBuilder(SxAdapter) > > Dim SxTable As New DataTable() > > SxTable.Locale = > > System.Globalization.CultureInfo.InvariantCulture > > SxAdapter.Fill(SxTable) > > SxSource.DataSource = SxTable > > Catch ex As OleDbException > > MessageBox.Show("Error") > > End Try > > End Sub > > > > > > > > "Arne Beruldsen" wrote: > > > >> When I go to update my datagridview...I get this error > >> > >> Dynamic SQL generation for the UpdateCommand is not supported against a > >> SelectCommand that does not return any key column information. > >> > >> using an update button...I have the following code: > >> > >> Dim cm As OleDb.OleDbCommandBuilder = New > >> OleDb.OleDbCommandBuilder(SxAdapter) > >> SxAdapter.Update(CType(SxSource.DataSource, DataTable)) > >> > >> I'm using 2005 > >> > >> Any ideas? > > VB2005 or 2003?
Robin S. -------------------------------- Show quoteHide quote "Arne Beruldsen" <ArneBeruld***@discussions.microsoft.com> wrote in message news:EF3BD3B7-1133-4353-9EB3-F9816ABB7BC7@microsoft.com... > Here is my GetData mod > > Private Sub GetData(ByVal selectCommand As String) > Try > Dim Cxx As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data > Source= " & Application.StartupPath & "\zAdmin.mdb;User > Id=admin;Password=;" > SQL = "Select LastName, FirstName, Date, Score from Scores" > ' Create a new data adapter based on the specified query. > SxAdapter = New OleDbDataAdapter(SQL, Cxx) > Dim MyCommandBuilder As New OleDbCommandBuilder(SxAdapter) > Dim SxTable As New DataTable() > SxTable.Locale = > System.Globalization.CultureInfo.InvariantCulture > SxAdapter.Fill(SxTable) > SxSource.DataSource = SxTable > Catch ex As OleDbException > MessageBox.Show("Error") > End Try > End Sub > > > > "Arne Beruldsen" wrote: > >> When I go to update my datagridview...I get this error >> >> Dynamic SQL generation for the UpdateCommand is not supported against a >> SelectCommand that does not return any key column information. >> >> using an update button...I have the following code: >> >> Dim cm As OleDb.OleDbCommandBuilder = New >> OleDb.OleDbCommandBuilder(SxAdapter) >> SxAdapter.Update(CType(SxSource.DataSource, DataTable)) >> >> I'm using 2005 >> >> Any ideas? Do you have Option Strict On and Option Explicit On, just to make sure
all of your variables are defined, and correctly? Where are Sql, SxAdapter, and SxSource defined, and as what? Robin S. ------------------------- Show quoteHide quote "Arne Beruldsen" <ArneBeruld***@discussions.microsoft.com> wrote in message news:EF3BD3B7-1133-4353-9EB3-F9816ABB7BC7@microsoft.com... > Here is my GetData mod > > Private Sub GetData(ByVal selectCommand As String) > Try > Dim Cxx As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data > Source= " & Application.StartupPath & "\zAdmin.mdb;User > Id=admin;Password=;" > SQL = "Select LastName, FirstName, Date, Score from Scores" > ' Create a new data adapter based on the specified query. > SxAdapter = New OleDbDataAdapter(SQL, Cxx) > Dim MyCommandBuilder As New OleDbCommandBuilder(SxAdapter) > Dim SxTable As New DataTable() > SxTable.Locale = > System.Globalization.CultureInfo.InvariantCulture > SxAdapter.Fill(SxTable) > SxSource.DataSource = SxTable > Catch ex As OleDbException > MessageBox.Show("Error") > End Try > End Sub > > > > "Arne Beruldsen" wrote: > >> When I go to update my datagridview...I get this error >> >> Dynamic SQL generation for the UpdateCommand is not supported against a >> SelectCommand that does not return any key column information. >> >> using an update button...I have the following code: >> >> Dim cm As OleDb.OleDbCommandBuilder = New >> OleDb.OleDbCommandBuilder(SxAdapter) >> SxAdapter.Update(CType(SxSource.DataSource, DataTable)) >> >> I'm using 2005 >> >> Any ideas? Defined as...
Private SxAdapter As New OleDbDataAdapter() Private SxSource As New BindingSource() Show quoteHide quote "RobinS" wrote: > Do you have Option Strict On and Option Explicit On, just to make sure > all of your variables are defined, and correctly? > > Where are Sql, SxAdapter, and SxSource defined, and as what? > > Robin S. > ------------------------- > > "Arne Beruldsen" <ArneBeruld***@discussions.microsoft.com> wrote in message > news:EF3BD3B7-1133-4353-9EB3-F9816ABB7BC7@microsoft.com... > > Here is my GetData mod > > > > Private Sub GetData(ByVal selectCommand As String) > > Try > > Dim Cxx As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data > > Source= " & Application.StartupPath & "\zAdmin.mdb;User > > Id=admin;Password=;" > > SQL = "Select LastName, FirstName, Date, Score from Scores" > > ' Create a new data adapter based on the specified query. > > SxAdapter = New OleDbDataAdapter(SQL, Cxx) > > Dim MyCommandBuilder As New OleDbCommandBuilder(SxAdapter) > > Dim SxTable As New DataTable() > > SxTable.Locale = > > System.Globalization.CultureInfo.InvariantCulture > > SxAdapter.Fill(SxTable) > > SxSource.DataSource = SxTable > > Catch ex As OleDbException > > MessageBox.Show("Error") > > End Try > > End Sub > > > > > > > > "Arne Beruldsen" wrote: > > > >> When I go to update my datagridview...I get this error > >> > >> Dynamic SQL generation for the UpdateCommand is not supported against a > >> SelectCommand that does not return any key column information. > >> > >> using an update button...I have the following code: > >> > >> Dim cm As OleDb.OleDbCommandBuilder = New > >> OleDb.OleDbCommandBuilder(SxAdapter) > >> SxAdapter.Update(CType(SxSource.DataSource, DataTable)) > >> > >> I'm using 2005 > >> > >> Any ideas? > > >
what is a static property and a cursor question
Why is this simple addition throwing an overflow exception? Delete Directory not working Data entry into ComboBox Create Serial Number VB.NET debug error VS 2005 baffled at step 1 Problem saving txt box with enter key How to run and communicate a DOS program file in a VB.NET program? Need help with CreateFile API function |
|||||||||||||||||||||||