Re: Problem updating a dataset within a button click handler
- From: "Ralph" <nt_consulting64@xxxxxxxxx>
- Date: Sat, 28 Oct 2006 14:57:22 -0500
"Southcoaster" <Southcoaster@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D079377B-B081-4D31-8353-8CD4C2723F9B@xxxxxxxxxxxxxxxx
I am relatively new to Visual Basic 2005 Express Edition.dataset
I am trying to create a simple program that:
1. Creates and populates a dataset in the form_load handler
2. Transfers control to a new form to input user changes to the data in a
Button2_Click event handler
3. returns control to the Button2_Click event handler to perform the
updatethe
However it can't find the data adapter 'custDA' to perform the update in
Button2_Click event handler.System.Data.SqlClient.SqlConnectionStringBuilder
Can anybody help please.
Many thanks.
Southcoaster.
Imports System.Data.SqlClient
Public Class MainCustomerSelectionForm
Dim custDS As DataSet = New DataSet("CustomerSelection")
Dim CustomerRecordForm As New CustomerRecordForm
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim builder As New
builder("Data Source") = ".\SQLEXPRESS"Customers",
builder("AttachDBFilename") = "C:\SQL Server 2000 Sample
Databases\NORTHWND.MDF"
builder("Integrated Security") = True
builder("Connect Timeout") = 30
builder("User Instance") = True
Dim nwindConn As New SqlConnection()
nwindConn.ConnectionString = builder.ConnectionString
Dim custDA As SqlDataAdapter = New SqlDataAdapter("SELECT * FROM
nwindConn)
nwindConn.Open()
custDA.Fill(custDS, "Customers")
Me.DataGridView1.DataSource = custDS
Me.DataGridView1.DataMember = "Customers"
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
CustomerRecordForm.ShowDialog()
*** ERROR OCCURS HERE AS IT CANNOT FIND 'CustDA' ***
custDA.Update(custDS, "Customers")
End Sub
End Class
You need to re-post to a dotNet newsgroup to get a wider audience of people
who use it. This news group is populated by programmers who use classic VB
(VB6 and below) and ADO (not ADO.Net, which is a very different critter).
Try...
news://msnews.microsoft.com/
microsoft.public.dotnet.languages.vb
microsoft.public.dotnet.languages.vb.data
microsoft.public.dotnet.framework.adonet
microsoft.public.dotnet.framework.windowsforms.controls
microsoft.public.dotnet.framework.windowsforms.databinding
-ralph
.
- Follow-Ups:
- Re: Problem updating a dataset within a button click handler
- From: Southcoaster
- Re: Problem updating a dataset within a button click handler
- References:
- Problem updating a dataset within a button click handler
- From: Southcoaster
- Problem updating a dataset within a button click handler
- Prev by Date: Problem updating a dataset within a button click handler
- Next by Date: Re: Problem updating a dataset within a button click handler
- Previous by thread: Problem updating a dataset within a button click handler
- Next by thread: Re: Problem updating a dataset within a button click handler
- Index(es):