943,982 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 1738
  • VB.NET RSS
Sep 21st, 2006
0

data grid problems...please help

Expand Post »
Why can't I get the changes in my grid to update the data base?

Here's the code..............


Public Class frmAddChangeDelete
Inherits System.Windows.Forms.Form
Dim currpath As String = System.Environment.CurrentDirectory
Dim connService As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source= " & currpath & "\ServiceCalls.mdb")
Private daCustomers
Private daCalls
Private daStatus



Private serviceDS As New DataSet




Private Sub frmAddChangeDelete_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim daCustomers As New System.Data.OleDb.OleDbDataAdapter("Select * from Customers", connService)
Dim daCalls As New System.Data.OleDb.OleDbDataAdapter("Select * from Calls", connService)
Dim daStatus As New System.Data.OleDb.OleDbDataAdapter("Select * from Status", connService)

daCustomers.Fill(serviceDS)
serviceDS.Tables(0).TableName = "Customers"
DataGrid1.DataSource = serviceDS.Tables("Customers")

daCalls.Fill(serviceDS)
serviceDS.Tables(1).TableName = "Calls"
DataGrid2.DataSource = serviceDS.Tables("Calls")

daStatus.Fill(serviceDS)
serviceDS.Tables(2).TableName = "Status"
DataGrid3.DataSource = serviceDS.Tables("Status")



DataGrid1.SetDataBinding(serviceDS, "Customers")


End Sub





Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click

Dim command_builder As New System.Data.OleDb.OleDbCommandBuilder(daCustomers)

Try
daCustomers.Update(serviceDS, "Customers")

Catch ex As Exception
MessageBox.Show(ex.Message)

End Try

















End Sub
End Class
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
SethR is offline Offline
33 posts
since Oct 2005
Sep 22nd, 2006
0

Re: data grid problems...please help

Hi,

There is no "Currpath" string in VB.NET, Instead try to give complete location of ServiceCalls.mdb database under 'Data Source'.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Baaskar R is offline Offline
1 posts
since Jun 2005
Sep 22nd, 2006
0

Re: data grid problems...please help

The currPath statement is working though. My datagrids are getting populated from the database. I'll try you're suggestion though.
Reputation Points: 10
Solved Threads: 1
Light Poster
SethR is offline Offline
33 posts
since Oct 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: I need help
Next Thread in VB.NET Forum Timeline: vb.net





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC