-
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;
-
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
Forum Rules
|
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
|
Bookmarks