20i Reseller Hosting

How To Get Data From A Row of a Database Into A Web Form

Discussion in 'Scripts and Coding' started by accelerator, Jul 22, 2015.

Thread Status:
Not open for further replies.
  1. accelerator United Kingdom

    accelerator Well-Known Member

    Joined:
    Apr 2005
    Posts:
    7,461
    Likes Received:
    114
    Guys, can anyone help with this?

    I'm repairing an old script written in VB.net 2.0. I'm a little rusty :oops:, so can someone give me a few pointers on what I need to do.

    I need to query a database where I hold Merchant details (I'm using MySQL with a custom provider). I just need to use MerchantId to lift a single Merchant's details (Name, Affiliate Link, Merchant Description etc), out of the database and populate these details into a Form where I can make edits to the Merchant's details.

    I just need a few reminders about the best way to code this. :p

    - So, I lift the merchant details out of the database with a MySQL query using the Merchant Id.

    - Then, what entity would I use to hold the data in order to put it into the form. A DataAdapter?? Or something else??

    - Then how do I get the data out of the DataAdapter (or similar??) and into the form fields for editing?

    I'm working out how to do this all now, but I could really use some pointers too.

    Many thanks :cool:
     
  2. Domain Forum

    Acorn Domains Elite Member

    Joined:
    1999
    Messages:
    Many
    Likes Received:
    Lots
    articles.co.uk
     
  3. nick-harper

    nick-harper Active Member

    Joined:
    Jun 2011
    Posts:
    402
    Likes Received:
    8
    Could you not do it in php? Much easier!!
     
  4. martin-s United Kingdom

    martin-s Well-Known Member

    Joined:
    Jul 2012
    Posts:
    3,347
    Likes Received:
    226
  5. accelerator United Kingdom

    accelerator Well-Known Member

    Joined:
    Apr 2005
    Posts:
    7,461
    Likes Received:
    114
    That's what I usually use these days. I switched over a few years ago, hence the questions ... it's throwback time.
     
  6. accelerator United Kingdom

    accelerator Well-Known Member

    Joined:
    Apr 2005
    Posts:
    7,461
    Likes Received:
    114
    I have a solution now, in case anyone's interested, it's roughly:

    Declare an SQL string

    Declare a DataAdapter

    Declare a DataSet

    Use the DataAdapter.Fill() method to fill the DataSet

    Use DataSet.Tables functionality to pick out row values from the DataSet

    Set the Text values of form fields to the row values picked out

    Thanks
     
Thread Status:
Not open for further replies.