944,120 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 7663
  • VB.NET RSS
May 2nd, 2006
0

view and edit data from database

Expand Post »
hi,sir,
i woul dlike to view the data from the database n edit them.but i dont know the coding..sir,please help me sir..i m developing the system using window based.thank you
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ezajan is offline Offline
1 posts
since May 2006
May 24th, 2006
0

Re: view and edit data from database

hi whats your name?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
khanayub_chand is offline Offline
13 posts
since May 2006
May 24th, 2006
0

Re: view and edit data from database

Reputation Points: 10
Solved Threads: 0
Newbie Poster
khanayub_chand is offline Offline
13 posts
since May 2006
Jun 8th, 2006
0

Re: view and edit data from database

Quote originally posted by ezajan ...
hi,sir,
i woul dlike to view the data from the database n edit them.but i dont know the coding..sir,please help me sir..i m developing the system using window based.thank you
Use SQL-key.

http://www.tampier.de
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Peng is offline Offline
1 posts
since Jun 2006
Jun 22nd, 2006
0

Re: view and edit data from database

Hai Sir
How i can connect to SQL server database with VB.Plz replay me
immediately.This is part of our project
Reputation Points: 10
Solved Threads: 0
Newbie Poster
2archu is offline Offline
3 posts
since Jun 2006
Jun 26th, 2006
0

Re: view and edit data from database

Hi

The way i do it is adding a datagrid to the form, then connect to the database using a oleDBconnection connection and get the dataset. Then create a dataview and set its source as the table you want to display from the dataset.

then set the dataview as the datasource of the datagrid, and that should do it.

When you close the form, make sure to check if the dataset has changes and update if necessary.


Here is the code:

VB.NET Syntax (Toggle Plain Text)
  1. Private con As OleDbConnection = New OleDbConnection
  2. Private comd As OleDbCommand = New OleDbCommand("SELECT * FROM Table", con)
  3. Private dst As DataSet = New DataSet
  4. Private dvw As DataView = New DataView
  5.  
  6. sub populate_datagrid()
  7.  
  8. con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & database_file & ";Mode=Read|Write"
  9.  
  10. comd.CommandTimeout = 30 ' oledbcommand
  11. dap.SelectCommand = comd ' data adapter
  12. dst.Clear() ' clear the data set
  13. dap.TableMappings.Clear() 'clear the data_adapter before using it
  14. dap.TableMappings.Add("Table", "Table_name")
  15. dap.Fill(dst, "Table_name")
  16. dvw.Table = dst.Tables(0)
  17. dvw.RowFilter = Nothing
  18. Me.datagrid1.DataSource = dvw
  19.  
  20. End sub

regards
Reputation Points: 23
Solved Threads: 10
Junior Poster
williamrojas78 is offline Offline
111 posts
since Jun 2005
Nov 4th, 2010
0
Re: view and edit data from database
It Did not work.... Permission error Help
Reputation Points: 10
Solved Threads: 0
Newbie Poster
WAFFLECOPTER is offline Offline
1 posts
since Nov 2010
Nov 4th, 2010
0
Re: view and edit data from database
It Did not work.... Permission error Help
which means you can't connect to your database
did you modify the code to connect to your DB ?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
eladreznik is offline Offline
16 posts
since Oct 2010

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: Extract updated text from texbox in datagrid
Next Thread in VB.NET Forum Timeline: Create Error log file





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


Follow us on Twitter


© 2011 DaniWeb® LLC