Click here to Skip to main content
15,912,507 members
Home / Discussions / Database
   

Database

 
AnswerRe: How to create trigger Pin
Pete O'Hanlon2-Jan-07 2:25
mvePete O'Hanlon2-Jan-07 2:25 
QuestionPL-SQL Command. Pin
Tuwing.Sabado1-Jan-07 20:35
Tuwing.Sabado1-Jan-07 20:35 
AnswerRe: PL-SQL Command. Pin
PIEBALDconsult3-Jan-07 10:51
mvePIEBALDconsult3-Jan-07 10:51 
QuestionDatabase module in DLL?? Pin
mothewizard1-Jan-07 9:56
mothewizard1-Jan-07 9:56 
QuestionINSERT in c# SQL Pin
groundzero1111-Jan-07 6:59
groundzero1111-Jan-07 6:59 
AnswerRe: INSERT in c# SQL Pin
Colin Angus Mackay1-Jan-07 8:36
Colin Angus Mackay1-Jan-07 8:36 
GeneralRe: INSERT in c# SQL Pin
groundzero1111-Jan-07 20:41
groundzero1111-Jan-07 20:41 
GeneralRe: INSERT in c# SQL Pin
Pete O'Hanlon1-Jan-07 22:39
mvePete O'Hanlon1-Jan-07 22:39 
groundzero111 wrote:
int x = 10;
int y = 20;
str= "INSERT INTO table1 (C1,C2) VALUES (x,y)";


There's your problem then. As x and y are inside the quotes, they are treated as literals. You would need to do this as:

str= string.Format("INSERT INTO table1 (C1,C2) VALUES ({0},{1})",x,y);


Before you go any further with this though, I would like to point out that it is a very bad idea to build your SQL like this and execute it. While you are only using local variables here, you will eventually want to move onto inserting data that has been input by a user and this is open to SQL Injection Attacks. See this article for more information:

SQL Injection Attacks[^]


the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer

Deja View - the feeling that you've seen this post before.

QuestionWhat is the keyword for record no Pin
prithaa1-Jan-07 0:16
prithaa1-Jan-07 0:16 
AnswerRe: What is the keyword for record no Pin
Uri Lavi1-Jan-07 0:37
Uri Lavi1-Jan-07 0:37 
GeneralRe: What is the keyword for record no Pin
prithaa1-Jan-07 0:54
prithaa1-Jan-07 0:54 
Questionpreventing delete of parent Pin
keroed_edmond31-Dec-06 7:16
keroed_edmond31-Dec-06 7:16 
AnswerRe: preventing delete of parent Pin
Pete O'Hanlon31-Dec-06 9:12
mvePete O'Hanlon31-Dec-06 9:12 
QuestionBest Practice For multiple Output Parameters Pin
Amit Kumar G31-Dec-06 3:10
Amit Kumar G31-Dec-06 3:10 
AnswerRe: Best Practice For multiple Output Parameters Pin
Colin Angus Mackay31-Dec-06 5:15
Colin Angus Mackay31-Dec-06 5:15 
GeneralRe: Best Practice For multiple Output Parameters Pin
Amit Kumar G31-Dec-06 7:02
Amit Kumar G31-Dec-06 7:02 
QuestionSystem.Transaction Pin
faviochilo30-Dec-06 3:57
faviochilo30-Dec-06 3:57 
QuestionConsistancy in Record Updation Pin
Kumar Nilesh29-Dec-06 21:00
Kumar Nilesh29-Dec-06 21:00 
AnswerRe: Consistancy in Record Updation Pin
Colin Angus Mackay30-Dec-06 1:00
Colin Angus Mackay30-Dec-06 1:00 
QuestionPlease Help Pin
naglayas29-Dec-06 15:35
naglayas29-Dec-06 15:35 
AnswerRe: Please Help Pin
Colin Angus Mackay30-Dec-06 0:59
Colin Angus Mackay30-Dec-06 0:59 
GeneralRe: Please Help Pin
Paul Conrad30-Dec-06 5:38
professionalPaul Conrad30-Dec-06 5:38 
GeneralRe: Please Help Pin
Colin Angus Mackay30-Dec-06 7:25
Colin Angus Mackay30-Dec-06 7:25 
JokeRe: Please Help Pin
Paul Conrad30-Dec-06 12:10
professionalPaul Conrad30-Dec-06 12:10 
GeneralRe: Please Help Pin
Colin Angus Mackay30-Dec-06 12:36
Colin Angus Mackay30-Dec-06 12:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.