|
-
Jan 9th, 2004, 08:13 AM
#1
Thread Starter
Member
DataGrid problem
hi all..
i'm just a beginner in vb.net..so i need a solution for a problem..what i'm trying to do is show all the records in a table in a datagrid. it works fine the first time..but when i click on the button that does this again, the grid has duplicate values..so if the button is pressed thrice..the records are repaeated 3 times. so how do i stop this ??
Code:
myAdapter = New OleDbDataAdapter("select * from Login", dbConn)
myAdapter.Fill(ds, "Login")
grdDetails.DataSource = ds
here myAdapter is a DataAdapter n ds is a DataSet.
any help will be appreciated...thnx a lot
-
Jan 9th, 2004, 08:38 AM
#2
Fanatic Member
set the dataset to a new instance every time you click the button, i.e. in the button click event
myDataset = new Dataset
-
Jan 10th, 2004, 12:06 AM
#3
Thread Starter
Member
thnx...it helped
but now i have another problem....
i'm trying to update the database thru the datagrid i.e. on the click of 'Update' button..i save the changes made in the datagrid.
for this purpose i've used the update method of the dataadapter
Code:
myAdapter.Update(ds)
where myAdapter is a OleDbDataAdapter, ds=dataset
i've filled in the myadapter on the click of 'Display button'..the code is in my first thread . so cud u plz tell me how do i update..coz this is showing an error.
-
Jan 10th, 2004, 02:05 AM
#4
New Member
Here amNewatVB this might help you to understand.
Click Here
One who asks is only laughed at for 5 minutes,
the one who doesn't ask is in the dark for life.
www.myfflbook.com
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
|