School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!
You're Browsing As A Guest! Register Now...
Become an Expert!

Join 358,764 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 3,777 people online right now.Registration is fast and FREE... Join Now!



Help with Datatables.

52 Weeks of Code Challenge:Android

Week #11 of the 52 Weeks of Code Challenge is Android, you should give it a shot. Click Here!
Page 1 of 1

Help with Datatables. I try to add new contents into Datatable after resetting it but new da Rate Topic: -----

#1 silverscarab  Icon User is offline

  • New D.I.C Head
  • Pip

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 02-November 09


Dream Kudos: 0

Posted 08 November 2009 - 01:07 AM

I'm working with DataTables.

I use the following code:

sqlCon.ConnectionString = "Data Source=localhost;Database=VivekDB;Integrated Security=true"
			sqlCom.CommandText = "select pname, pcode from components where designid = '" & designID & "' and pcode like 'BT%' order by pname"
			sqlCom.Connection = sqlCon

			da.SelectCommand = sqlCom
			sqlCon.Open()
			da.Fill(ds, "Bottom Tracks")
			sqlCon.Close()
			sqlCon.Dispose()
			sqlCom.Dispose()


			dt = ds.Tables("Bottom Tracks")
			bindList(ltbBot, dt, "pname", "pcode")




As you can see I m providing a listbox to the user to select some deisgn type, and then accordingly the various data is loaded into the other listbox, which is being binded to the datatable using the bindlist sub (last line)

Now the problem is: My form has a back button, So that the user can modify his designs... Now when the above code gets re executed, the new data that is retrived gets appended to the previously fetched data...

How can I get rid of this problem?

Please help :)
Was This Post Helpful? 0
  • +
  • -


#2 silverscarab  Icon User is offline

  • New D.I.C Head
  • Pip

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 02-November 09


Dream Kudos: 0

Re: Help with Datatables.

Posted 08 November 2009 - 01:25 AM

Found the answer,

I should cleared the dataset using

ds.clear()


Thank you for reading :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1


Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month