Results 1 to 3 of 3

Thread: retreaving and displaying data!!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2000
    Posts
    103
    im learning vb at the moment
    i have 2 command buttons on my form called show and save, a
    listview control on my form
    i would like to connect to my SQL database called
    mydatabase on my server called 'nt009'
    my username is sa and there is no password
    "select firstname from mytable"
    "select surname from mytable"
    and display all the firstnames and surnames
    in my listview control under two headings
    name and surname and be able to edit that data then clcik on my
    save button to save that data that i edited in
    my listview control????
    can this be done??
    ive been trying for days but i cannot get it right
    please help me!!!!

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Posts
    125
    this would be fairly difficult coding since the listview is not a bound control

    why not do this with a DBGrid - It is made to do specifically what you want

  3. #3
    Addicted Member c@lle's Avatar
    Join Date
    Oct 1999
    Location
    Belgium
    Posts
    179
    first of all: never leave the password for the 'sa' user blank!!! Give it a password, write it down in a save place, create another administrator user and work with this one.

    Then, you can use the 'data environment' for connecting to the sql server database. You can find it under: project -> components. Then the tab 'designers' and 'data environment'.

    Now rightclick in the project window, choose 'add' , 'data environment'

    Now rightclick on connection1, choose 'microsoft ole db provider for sql server' and fill in the desired fields.

    Now you have a connection!
    You can create a 'command' and write sql for retrieving data from tables.
    You can drag the commands to a form and automatically you have the fields on the form.

    hth.



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