| | |
Can Save Data but Unable to view unless restart application.
Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Dec 2008
Posts: 9
Reputation:
Solved Threads: 0
Hi All,
Please Help me with this issue as i m very new to VB.NET.
I have Created a vb.net Application with MS ACCESS DATABASE, everything is working fine, But, There is a small problem that i am facing . Everytime i ADD a new record it saves succesfully
but i can only view that particular saved data only after restarting the application..Pls Help me
******************************************************
Imports System.Data
Public Class frmdetail
Inherits System.Windows.Forms.Form
Dim inc As Integer
Dim maxrows As Integer
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Private Sub frmdetail_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source = C:\Documents and Settings\Acer\Desktop\CounsellingSystem\counselling.mdb"
con.Open()
sql = "select * from counselling"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "counselling")
con.Close()
maxrows = ds.Tables("counselling").Rows.Count
inc = -1
End Sub
Private Sub navigaterecords()
txtname.Text = ds.Tables("counselling").Rows(inc).Item(1)
txtcname.Text = ds.Tables("counselling").Rows(inc).Item(2)
txtnpos.Text = ds.Tables("counselling").Rows(inc).Item(3)
End Sub
Private Sub btncommit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncommit.Click
If inc <> -1 Then
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim dsnewrow As DataRow
dsnewrow = ds.Tables("counselling").NewRow()
dsnewrow.Item(1) = txtname.Text
dsnewrow.Item(2) = txtcname.Text
dsnewrow.Item(3) = txtnpos.Text
END SUB
End Class
***************************************************
Pls Help Me!
Please Help me with this issue as i m very new to VB.NET.
I have Created a vb.net Application with MS ACCESS DATABASE, everything is working fine, But, There is a small problem that i am facing . Everytime i ADD a new record it saves succesfully
but i can only view that particular saved data only after restarting the application..Pls Help me
******************************************************
Imports System.Data
Public Class frmdetail
Inherits System.Windows.Forms.Form
Dim inc As Integer
Dim maxrows As Integer
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Private Sub frmdetail_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source = C:\Documents and Settings\Acer\Desktop\CounsellingSystem\counselling.mdb"
con.Open()
sql = "select * from counselling"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "counselling")
con.Close()
maxrows = ds.Tables("counselling").Rows.Count
inc = -1
End Sub
Private Sub navigaterecords()
txtname.Text = ds.Tables("counselling").Rows(inc).Item(1)
txtcname.Text = ds.Tables("counselling").Rows(inc).Item(2)
txtnpos.Text = ds.Tables("counselling").Rows(inc).Item(3)
End Sub
Private Sub btncommit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncommit.Click
If inc <> -1 Then
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim dsnewrow As DataRow
dsnewrow = ds.Tables("counselling").NewRow()
dsnewrow.Item(1) = txtname.Text
dsnewrow.Item(2) = txtcname.Text
dsnewrow.Item(3) = txtnpos.Text
END SUB
End Class
***************************************************
Pls Help Me!
![]() |
Similar Threads
- Cannot find server or DNS Error - please help! (Viruses, Spyware and other Nasties)
Other Threads in the VB.NET Forum
- Previous Thread: delegate problem: invoke without parameters
- Next Thread: This Vb.Net code will copy a file to a location and its extension
Views: 373 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
"crystal .net .net2005 2008 access add application array assignment basic box button buttons center class click code combo convert cpu data database datagrid datagridview design designer dissertation dissertations dissertationthesis dosconsolevb.net editvb.net employees error excel exists firewall function image images isnumericfuntioncall listview login map math memory mobile module msaccess mssqlbackend mysql navigate net opacity page pan picturebox port print printing printpreview problem record refresh regex reports" reuse right-to-left save savedialog search serial socket sorting sql sqldatbase storedprocedure string structures studio temp textbox timer txttoxmlconverter upload useraccounts usercontol usercontrol vb vb.net vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet vista visual visualbasic visualbasic.net visualstudio2008 web wpf xml





