strings to a database


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: strings to a database

  1. #1
    alex Guest

    strings to a database


    How would you insert two differents Strings to two differents field column
    but in the same row. For example If I have the following declarations: String
    a = "hello";
    String b ="World";

    Database: Table
    Field 1 Field 2
    -------- -------
    row1 hello World

    I know that you can use: insert into "Table" (Field1) values('" + a +"'));
    This statement works for single entry.But What I want is multiple access.
    My problem is that when I put :
    insert into "Table" (Field1,Field2) values('" + a + b+"')); It won't update
    my database

    Can somebody help me
    thanks;

  2. #2
    Thomas Skariah Guest

    Re: strings to a database


    The syntax should be

    insert into tablename (field1, field2) values("'" + a "', '" + b + "'");

    Each string should be surrounded with a (') and each field should be seperated
    with (,).


    "alex" <delgadoalex2001@aol.com> wrote:
    >
    >How would you insert two differents Strings to two differents field column
    > but in the same row. For example If I have the following declarations:

    String
    >a = "hello";
    > String b ="World";
    >
    >Database: Table
    > Field 1 Field 2
    > -------- -------
    >row1 hello World
    >
    >I know that you can use: insert into "Table" (Field1) values('" + a +"'));
    >This statement works for single entry.But What I want is multiple access.
    >My problem is that when I put :
    > insert into "Table" (Field1,Field2) values('" + a + b+"')); It won't update
    >my database
    >
    >Can somebody help me
    >thanks;



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center