DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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;



Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links