Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / November 2006

Tip: Looking for answers? Try searching our database.

Updating Datagridview

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Arne Beruldsen - 27 Nov 2006 00:41 GMT
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?
Ken Tucker [MVP] - 27 Nov 2006 01:16 GMT
Hi,

       What is the select command for SxAdapter?

Ken
--------------------------
> When I go to update my datagridview...I get this error
>
[quoted text clipped - 10 lines]
>
> Any ideas?
Arne Beruldsen - 27 Nov 2006 01:24 GMT
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

> When I go to update my datagridview...I get this error
>
[quoted text clipped - 9 lines]
>
> Any ideas?
Ken Tucker [MVP] - 27 Nov 2006 01:43 GMT
Hi,

      I think date is an keyword.  Try this for the select statement

SQL = "Select LastName, FirstName, [Date], Score from Scores"

Ken
------------------
> Here is my GetData mod
>
[quoted text clipped - 31 lines]
>>
>> Any ideas?
Arne Beruldsen - 27 Nov 2006 02:31 GMT
Good thought but still didn't work...I even changed the column to
TestDate...still no luck...:(

I'm stumped

> Hi,
>
[quoted text clipped - 39 lines]
> >>
> >> Any ideas?
RobinS - 27 Nov 2006 03:45 GMT
VB2005 or 2003?

Robin S.
--------------------------------
> Here is my GetData mod
>
[quoted text clipped - 31 lines]
>>
>> Any ideas?
RobinS - 27 Nov 2006 03:50 GMT
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.
-------------------------

> Here is my GetData mod
>
[quoted text clipped - 31 lines]
>>
>> Any ideas?
Arne Beruldsen - 27 Nov 2006 04:29 GMT
Defined as...

Private SxAdapter As New OleDbDataAdapter()
Private SxSource As New BindingSource()

> Do you have Option Strict On and Option Explicit On, just to make sure
> all of your variables are defined, and correctly?
[quoted text clipped - 39 lines]
> >>
> >> Any ideas?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.