Results 1 to 3 of 3

Thread: How to insert values without knowing field names

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    57

    How to insert values without knowing field names

    I want to Insert Values into an existing record of an SQL table, without knowing the field names.
    Normally I do the following :
    "INSERT INTO tblA ([User],[Date]) VALUES ('A','B') WHERE <condition>"

    ....but in this instance I don't know the field names ([User],[Date]), I merely want to insert the values into the 2nd and 3rd fields.

  2. #2
    Addicted Member
    Join Date
    Aug 2002
    Location
    Belfast, N. Ireland
    Posts
    167
    You could use the fields collection of the recordset:

    VB Code:
    1. rs.Fields(0) = "Hello World"

  3. #3
    Frenzied Member seoptimizer2001's Avatar
    Join Date
    Apr 2001
    Location
    Toledo, Ohio USA GMT -5
    Posts
    1,075
    Why wouldn't you know where you are putting the data? Can you just create a stored procedure then you have...
    VB Code:
    1. strSQL = "usp_ProcedureName 'A','B'"
    seoptimizer2001
    VB 6.0, VC++, VI, ASP, JavaScript, HTML,
    Perl, XML, SQL Server 2000

    If God had intended us to drink beer, He would have given us stomachs.


    Please use the [code] and [vbcode] tags in your posts!
    If you don't know how to use them please go HERE!


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