Results 1 to 12 of 12

Thread: Data Source and Field - Solved (Not with data source)

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Location
    Porto Alegre, RS
    Posts
    210

    Data Source and Field - Solved (Not with data source)

    How can i set the data source and data field to textboxes on VB.net???

    in VB6 i used to do:
    VB Code:
    1. txt_user.DataSource = rs
    2. txt_user.DataField = user

    Thank you,
    Guilherme
    Last edited by gccosta; Oct 2nd, 2003 at 09:04 AM.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    In .NET , I think it's similar to this .
    VB Code:
    1. TextBox1.DataBindings.Add(new Binding("bind",ds,"table")

  3. #3
    Lively Member
    Join Date
    Sep 2003
    Location
    Chicago, IL
    Posts
    64
    Do not use binding. it sucks and will cause you headaches later.
    Mike Stammer

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by MikeStammer
    Do not use binding. it sucks and will cause you headaches later.
    I agree this time . But I tried to answer the guy whether I like or dislike binding .Do your work in code .

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Location
    Porto Alegre, RS
    Posts
    210
    that works using ADO.Net.
    Anybody knows how to do that using ADODB????

    Thanks,
    Guilherme

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Location
    Porto Alegre, RS
    Posts
    210
    if you say that binding is bad, what do you recommend???

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by gccosta
    if you say that binding is bad, what do you recommend???
    use code or iterate the control you'd like with the data in the database or whatever .

  8. #8
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by gccosta
    that works using ADO.Net.
    Anybody knows how to do that using ADODB????
    Thanks,
    Guilherme
    Dude , that's old-fashioned model . In .NET ADO.NET is super cool . Just give it a chance you won't regret it .

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Location
    Porto Alegre, RS
    Posts
    210
    i was thinking in doing this by code, but i´m afraid that it cen get a little slow!!

  10. #10
    Lively Member
    Join Date
    Sep 2003
    Location
    Chicago, IL
    Posts
    64
    have a class that does all your data access and then returns another class that represents wha you are working on.

    Then you change values of controls based on this object:

    txtFoo.text = myObject.PropertyFoo


    Then if someone changes txtFoo you do this:

    myObject.PropertyFoo = txtFoo.text

    and pass the object back to your data access class that takes the changes and persists them to the database.

    Databinding is WAY slower than manually doing it. Thing of all the crap that has to be tracking doing it automagically by the run time vs you managing it via code.
    Mike Stammer

  11. #11
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by gccosta
    i was thinking in doing this by code, but i´m afraid that it cen get a little slow!!
    Why how much data do you have ? a million record maybe ?

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Location
    Porto Alegre, RS
    Posts
    210
    i did by code, and it will spend some time to be slow, today i have only 750 registers on the DB!!

    Thanks for your help!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width