Hi friends,
I was wondering if we can write a method which takes an arraylist object(Column name,column values) and sql table name to build a sql query.... I have not used Arraylist as of now and i need your help to do this please...
Thanks
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Jul 25, 2012, 2:19 PM
Here's something I've quickly thrown together on these lines. As it's possible that the table and column names could be reserved words in whatever RDMS you're using the only safe thing to do is to wrap all names in square brackets:
The output of this program is:
INSERT INTO [Person] ([Name], [ID], [Status]) VALUES ('Rani', 1, null)
VulpesPosted Jul 26, 2012, 4:12 AM
rani m mkPosted Jul 26, 2012, 1:03 AM