This is a migrated thread and some comments may be shown as answers.

Updating SQL Db from RadGrid

3 Answers 222 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dan Stevens
Top achievements
Rank 1
Dan Stevens asked on 30 May 2007, 05:57 PM
My Grid is populated with the following code:
cn.Open()
Dim dt As New DataTable
Dim da As New SqlDataAdapter("SELECT * from MyTbl WHERE [JobID] = '123', cn)
da.Fill(dt)
Me.RadGridView1.DataSource = dt

When I edit a cells contents and then move to the next row.  I should be able to send updates to SQL.   I tried using the event RadGridView1_CurrentRowChanged and then:
Dim strColValue As String = e.OldRow.Cells("myCol").Value.ToString
But the Old Value is returned.

How do I get an efficient 2-way link established between RadGrid & SQL?

Thanks in advance for any help.
-New Telerik Winforms user

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 31 May 2007, 11:58 AM
Hello Dan,

You are right, this is a problem and we reproduced it locally. When you change the CurrentRow old values are returned. We will fix this in our next service pack.

We apologize for any inconveniences caused. Please tell us if this is a show stopper bug so that we can arrange for a solution.

Your telerik points have been updated.

Best wishes,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Sasa Milovic
Top achievements
Rank 1
answered on 14 Jun 2007, 02:05 PM
Hi

Does this mean the Grid does not update what it is bound to?

I've tried this example and it doesn't seem to update the underlying data table!

dt = New DataTable

dt.Columns.Add("First")

dt.Columns.Add("Second")

Dim rw As DataRow

rw = dt.NewRow

rw(0) = "value1"

rw(1) = "value2"

dt.Rows.Add(rw)

rw = dt.NewRow

rw(0) = "value3"

rw(1) = "value4"

dt.Rows.Add(rw)

 

RadGridView1.DataSource = dt

If I edit the row, and then debug, the values in the table remain unchanged. However, adding a new row works?

0
Julian Benkov
Telerik team
answered on 15 Jun 2007, 02:54 PM
Hi Sasa ,

We did not find any problems with updates of binding  DataTable objects within your sample code.

To update the SQL DB you must be use SqlDataAdapter. After the DataTable is changed in RadGridView, simply call the Update function of the adapter.

If you continue have this problem, please open a support ticket and send your application.

FYI, next week we will provide SP2 release with more fixes and improvements.


Kind regards,
Julian Benkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Dan Stevens
Top achievements
Rank 1
Answers by
Jack
Telerik team
Sasa Milovic
Top achievements
Rank 1
Julian Benkov
Telerik team
Share this question
or