Results 1 to 7 of 7
Thread: need help in sql statement
- 03-28-2010, 09:01 AM #1
Member
- Join Date
- Aug 2009
- Posts
- 23
- Rep Power
- 0
need help in sql statement
question 1 :
how can i write sql statement that insert data in table that contain a field with data type auto number??
eg :
my reception table contain 2 field
No and patient
No 's data type is auto nu,ber
patient 's data type is text
how can i write the sql statement????
question 2 :
how can i take all the data in the column??
eg :
medicine quantity
a <t> 1
b 2
how cna i get all medicine data and save it into array??
- 03-28-2010, 01:01 PM #2
hallo, do you already have established a connection with the database you want to use? a'm asking, because explaining all the details you need can take very long. so why don't your read this http://www.java-forums.org/java-tuto...nectivity.html first? after ou should be able to insert data in your table.
- 03-28-2010, 01:31 PM #3
Member
- Join Date
- Aug 2009
- Posts
- 23
- Rep Power
- 0
i noe way to connect database..i dunno how to insert data into table which contain autonumber datatype
eg :
normally we use tis sql to insert data
INSERT INTO PATIENT VALUES ("abc","abc")
but how can i insert data into table which have autonumber data type
- 03-28-2010, 04:02 PM #4
- 03-28-2010, 04:39 PM #5
Member
- Join Date
- Aug 2009
- Posts
- 23
- Rep Power
- 0
i had try tis way
INSERT INTO PATIENT ( Patient ) VALUES ( "abc" )
but fail.
1st column is no , data type autonumber
2nd column is patient , data type textLast edited by chyeeqi; 03-28-2010 at 04:42 PM.
- 03-28-2010, 05:23 PM #6
i don't know which database you use but read the documentation about autonumber for your database.
in java single quotes are used to wrap strings. to make the sql-code more readable use PreparedStatements. you will find a good documentation is the "Java Tutorials" forum.
- 03-28-2010, 08:49 PM #7
Member
- Join Date
- Aug 2009
- Posts
- 23
- Rep Power
- 0
Similar Threads
-
for statement help
By helpisontheway in forum New To JavaReplies: 5Last Post: 11-14-2009, 05:14 PM -
if statement help please!!
By soc86 in forum New To JavaReplies: 5Last Post: 12-02-2008, 03:56 PM -
If statement, please help??
By soc86 in forum New To JavaReplies: 5Last Post: 11-23-2008, 03:58 PM -
Help with if statement
By carl in forum New To JavaReplies: 1Last Post: 08-06-2007, 08:53 AM -
Statement or Prepared Statement ?
By paty in forum JDBCReplies: 3Last Post: 08-01-2007, 05:45 PM
Bookmarks