|
|||||||
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
Addicted Member
Join Date: May 06
Posts: 178
![]() |
Hi;
I try to get informations from an Access DB. There is tabcontrol. There are some tabstops. If you enter a tabstop it tries to update data in Datagridview. But at the first time you enter to tabstop it normally takes data from database. If you try to take data for a second time you need to do this: VB Code:
and in this function I get the error, which is written in the title: VB Code:
__________________
Dim Me As Coder |
|
|
|
|
|
#2 |
|
Invisible
Join Date: May 02
Posts: 13,261
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: [2005] "A DataTable named 'Stok' already belongs to this DataSet."
1) Are you trying to use ADO or ADO.NET? Your code is using both. Pick one or the other and stick to it.
2) Yes, you are clearing the TABLES.... not the dataset.... big difference. Instead of using .CLEAR, check to see if the table exists in the Dataset first, then remove the table from the collection. Then you can fill it and add it back it..... -tg
__________________
How to Use Parameters * I don't respond to private requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.* * Got Eels in your Hovercraft? * * Your guide to The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft * *Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? * On Error Resume Next is error ignoring, not error handling(tm). * Use Offensive Programming, not Defensive Programming. "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN MVP '06-'10
|
|
|
|
|
|
#3 |
|
Addicted Member
Join Date: May 06
Posts: 178
![]() |
Re: [2005] "A DataTable named 'Stok' already belongs to this DataSet."
for 1) Hmm but it works good exccept this
for 2) it seems that it doesnt exists after clear function but it gives the error
__________________
Dim Me As Coder |
|
|
|
|
|
#4 |
|
.NUT
Join Date: May 05
Location: Sydney, Australia
Posts: 54,913
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: [2005] "A DataTable named 'Stok' already belongs to this DataSet."
My question is "why remove the table in the first place". If you just call the Fill method of a DataAdapter and pass a DataSet and a table name then it will populate a DataTable with that name, creating it if it doesn't exist. If you want to get rid of existing data then just clear the contents of the table:
VB Code:
__________________
![]() 2007, 2008, 2009, 2010 Why is my data not saved to my database? | Communicating between multiple forms | MSDN Data Walkthroughs MSDN "How Do I?" Videos: VB | C# VBForums Database Development FAQ My CodeBank Submissions: VB | C# (ForumAccount has translated some of my VB submissions to C#) My Blog: Defining and Raising Custom Events | Manipulating GDI+ Drawings | Using Parameters in ADO.NET |
|
|
|
|
|
#5 |
|
Addicted Member
Join Date: May 06
Posts: 178
![]() |
Re: [2005] "A DataTable named 'Stok' already belongs to this DataSet."
Thanks again... it worked great jmchil
__________________
Dim Me As Coder |
|
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|