Skip to Main Content

Oracle Developer Tools for Visual Studio

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

datagrid update in vb.net

user482382Jan 26 2006
I have a asp.net form that has 2 datagrids (master & detail) The master grid shows all the summary from 16 different tables. When the user click on a master datagrid row it populates 1 row in the detail datagrid that the user can update. The issue is that the detail grid is getting populated from 1 of 16 different tables and i am looking for an easy way to post the update to the database. I am trying to use "da.Update(ds, "batch")" so i would not care which table the user is updating; when i try run this code I get this error message
[InvalidOperationException: Update unable to find TableMapping['batch'] or DataTable 'batch'.]
System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
DataGrid1.WebForm1.detailsClicked(Object sender, DataGridCommandEventArgs e) in c:\inetpub\wwwroot\DataGrid1\WebForm1.aspx.vb:78".

here is my code:

Public Class WebForm1
Inherits System.Web.UI.Page
Dim myConnection As OracleConnection = New OracleConnection
Dim mySelectQuery As String = "select REC_ID, job_title_name from job_title_tbl "
Dim myCommand As New OracleCommand(mySelectQuery, myConnection)
Dim ds As New DataSet
Dim da As New OracleDataAdapter(myCommand)
Dim cmd As New OracleCommand

End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

If Not Page.IsPostBack Then
BindData()
End If

End Sub
Sub BindData()
myConnection.ConnectionString = "Data Source=sam;User Id=scott;Password=tiger;Pooling=false"
Try
myConnection.Open()
Console.WriteLine("Connection to Oracle database established successfully !")
Console.WriteLine(" ")
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try

da.Fill(ds, "batch")
Me.DataGrid1.DataSource = ds.Tables("batch")

DataGrid1.DataKeyField = "rec_id"

DataGrid1.DataBind()


End Sub
Sub detailsClicked(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
Dim showrow As String
Dim showcol As String

showrow = CStr(DataGrid1.DataKeys(e.Item.ItemIndex))
showcol = CStr(e.CommandName)
' Response.Write("You clicked row " & showrow & " " & showcol & " button!")

da.Update(ds, "batch")

End Sub

End Class
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 23 2006
Added on Jan 26 2006
0 comments
1,301 views