|
-
Nov 24th, 2005, 01:50 AM
#1
Thread Starter
Junior Member
How to link grid control with the database using oledbconnection?
i'm new in vb.net and i am having the problem as the topic stated.
i don have any source code for the connection because i really donno how to do. so i need help from someone here and help me out for my problem.
thank you.
-
Nov 24th, 2005, 02:14 AM
#2
Re: How to link grid control with the database using oledbconnection?
look at http://www.connectionstrings.com , has connections strings for all sorts of different types of providers
-
Nov 24th, 2005, 02:33 AM
#3
Re: How to link grid control with the database using oledbconnection?
Check out some of the tutorial links in my signature, as well as the 101 samples. You'll find plenty of ADO.NET stuff there.
-
Nov 24th, 2005, 02:35 AM
#4
Thread Starter
Junior Member
Re: How to link grid control with the database using oledbconnection?
how you get a data from a database and place it in a text box.
what i mean is a row of data from a table.
-
Nov 24th, 2005, 02:37 AM
#5
Re: How to link grid control with the database using oledbconnection?
requires several items using ADO.NET, as JM said... best to read up on it so you understand it first before you try anything... using the links in his sig...
-
Nov 24th, 2005, 02:39 AM
#6
Thread Starter
Junior Member
Re: How to link grid control with the database using oledbconnection?
 Originally Posted by gigemboy
 Originally Posted by jmcilhinney
Check out some of the tutorial links in my signature, as well as the 101 samples. You'll find plenty of ADO.NET stuff there.
Thanx ^^
-
Nov 24th, 2005, 02:42 AM
#7
Re: How to link grid control with the database using oledbconnection?
If you installed the documentation, there is a good intro article titled "Introduction to Data Access with ADO.NET", or you can search MSDN for that article as well...
**EDIT
For a more in depth article with full examples, check out the article "Accessing Data with ADO.NET"
-
Nov 24th, 2005, 02:42 AM
#8
Re: How to link grid control with the database using oledbconnection?
 Originally Posted by brian84
how you get a data from a database and place it in a text box.
what i mean is a row of data from a table.
We're not trying to be unhelpful, but giving bits of code when you don't understand the subject is like teaching someone who doesn't know how to drive how to turn left: it's great for that specific circumstance but it doesn't really help much overall. Your thread title says you want to link a grid to a database. The last step of that process is to assign a DataTable object to the DataSource property of either a DataGrid or DataGridView, depending on which version of VB.NET you're using. If you don't know how to populate the DataTable in the first place then you should take our advice and do some reading.
-
Nov 24th, 2005, 05:40 AM
#9
Thread Starter
Junior Member
Re: How to link grid control with the database using oledbconnection?
The problem to connect the odbc with grid control had been solve but another problem occur again.
after i connect the odbc and grid control together, i tried to view the table from the dataadapter's preview data and i works when i click to fill the dataset.
but then i execute the code, the grid control do not show any data but oni the header and column name.
wat is the problem here..??
how can i show the data in the grid contorl..??
* i only use a dataset without datatable and dataview
*Problem solved
Last edited by brian84; Nov 24th, 2005 at 10:28 PM.
-
Nov 25th, 2005, 01:26 AM
#10
Thread Starter
Junior Member
Re: How to link grid control with the database using oledbconnection?
i having another problem where i cannot update my data in the database/
it is update using a datagrid
i used the following code to update but it does not work.
anybody can help what i should do before this code and after the code
OleDbDataAdapter1.Update(DataSet1)
-
Nov 25th, 2005, 01:50 AM
#11
Re: How to link grid control with the database using oledbconnection?
You have to set the commandbuilder... it should automatically create the correct update commands when you call .update for general cases... sometimes this does not work if you are pulling data from multiple tables, etc...
VB Code:
Dim MyAdapter As New System.Data.OleDb.OleDbDataAdapter("SELECT * FROM " & strTable, strConn) 'just an example of an oledbdataadapter
Dim MyCmdBuilder As New System.Data.OleDb.OleDbCommandBuilder(MyAdapter) 'creates the commandbuilder
MyAdapter.Update(MyDataSet) 'update should now work now that the commandbuilder is set
-
Nov 25th, 2005, 02:43 AM
#12
Re: How to link grid control with the database using oledbconnection?
Just FYI, there is no such thing as a DataSet without a DataTable. A DateSet contains DataTables and DataRelations. It is the DataTable that contains the data, or more correctly that contains the DataRows that contain the data. If you are working with a single table of data and using a DataSet then you are adding an unnecessary layer of complexity. That's like creating an array that will only ever have one element.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|