VB.NET DataAdapter ? ? ?
VB.NET DataAdapter ? ? ?
VB.NET DataAdapter ? ? ?
VB.NET DataAdapter ? ? ?
VB.NET DataAdapter ? ? ?
VB.NET DataAdapter ? ? ? VB.NET DataAdapter ? ? ? VB.NET DataAdapter ? ? ? VB.NET DataAdapter ? ? ? VB.NET DataAdapter ? ? ? VB.NET DataAdapter ? ? ? VB.NET DataAdapter ? ? ? VB.NET DataAdapter ? ? ?
VB.NET DataAdapter ? ? ? VB.NET DataAdapter ? ? ?
VB.NET DataAdapter ? ? ?
Go Back  Xtreme Visual Basic Talk > > > VB.NET DataAdapter ? ? ?


Reply
 
Thread Tools Display Modes
  #1  
Old 10-07-2008, 12:59 AM
merianos merianos is offline
Newcomer
 
Join Date: Sep 2008
Posts: 2
Exclamation VB.NET DataAdapter ? ? ?


Hello all . . .

I try to create a form that managing the access level of user managment system.

The model I use is the following :


I create a connection to database
I create a DataAdapter to transfer the data from the database
I create a Dataset to hold my data
My form consists of the following :

A ListBox that list all the access level names
Three text boxes:
The first for the record ID
The second for the access level name
And the third for the discription of the access level
Five check boxes:
One for writing rights
One for the deleting rights
One for the Updating rights
One for Printing rights
And one for Special area access rights

So what i do is the following :

I create a connection string
I create a new connection to my database server
I create the DataAdapter
I initializing the DataAdapter command such as SelectCommand, DeleteCommand, e.t.c..
I fill my DataSet with the data DataAdapter get from DataBase
I binding my controls to DataSet
I setting the DataSource property of the ListBox to my DataSet
I setting the DisplayMember to the ACCL_NAME column of the DataTable inside the DataSet
I setting the ValueMember to ACCL_ID column of the DataTable inside the DataSet

Until this time all are fine ! ! !

The question is :

When i try to add a new row to dataset by using the following code i have a problem :

Dim newRow As DataRow = Dataset.Tables("TableName").NewRow

newRow("COLUMN_NAME") = Binded Control Value

DataSet.Tables("TableName").Rows.Add(newRow)

The problem is that when i try to add a new row by this way then i get two rows of data in my ListBox

Then if i try to add another then i have bigger scale of this problem ! ! !

What can i do ? ? ?

Many many thanks ! ! ! !
Reply With Quote
  #2  
Old 10-09-2008, 09:46 AM
MaslowB MaslowB is offline
Freshman
 
Join Date: Sep 2008
Location: Jacksonville, Florida
Posts: 34
Default

it sounds like you are either calling the add function twice and don't know, have you tried setting a breakpoint there and seeing if it does get called twice?

or if it is duplicating other rows besides the new one, then it is re-adding the entire dataset. if this is the case clearbefore fill, or calling listbox1.items.clear before re-filling it could help. or finding out why it is refilling the listbox instead of just adding the individual item.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
VB.NET DataAdapter ? ? ?
VB.NET DataAdapter ? ? ?
VB.NET DataAdapter ? ? ? VB.NET DataAdapter ? ? ?
VB.NET DataAdapter ? ? ?
VB.NET DataAdapter ? ? ?
VB.NET DataAdapter ? ? ? VB.NET DataAdapter ? ? ? VB.NET DataAdapter ? ? ? VB.NET DataAdapter ? ? ? VB.NET DataAdapter ? ? ? VB.NET DataAdapter ? ? ? VB.NET DataAdapter ? ? ?
VB.NET DataAdapter ? ? ?
VB.NET DataAdapter ? ? ?
 
VB.NET DataAdapter ? ? ?
VB.NET DataAdapter ? ? ?
 
-->