|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Inserting info in a tableHi
I have a set of values that I need to insert and sql server table. My question is, out of all the methods what is the best (in terms of being simplest/most straightforward) method to do that? Thanks Regards John,
> I have a set of values that I need to insert and sql server table. My Assuming you want to do this with a .Net program.> question is, out of all the methods what is the best (in terms of being > simplest/most straightforward) method to do that? > Create a Transact SQL insert string and process that with execute.nonquery I hope this helps, Cor >> what is the best (in terms of being simplest/most straightforward) method Depends on what you find the simplest. Maybe you could enter the datain manually ! What could be simpler ! ;-) The most basic syntax is
INSERT INTO tableName VALUES( value1, value2 . . . . . ) Things to bear in mind about using this approach. 1.) Your values MUST be in sequence with the table design 2.) If ANY of your values include single quotes ' then your statement will fail. Using Parameters if more time consuming, but far less prone to error Show quote "John" <John@nospam.infovis.co.uk> wrote in message news:OZS1TqDYGHA.4992@TK2MSFTNGP03.phx.gbl... > Hi > > I have a set of values that I need to insert and sql server table. My > question is, out of all the methods what is the best (in terms of being > simplest/most straightforward) method to do that? > > Thanks > > Regards > Parameters will also prevent any possible "Sql Injection"attack, as
something that would be an executable statement if inlined is simply text if it's a parameter value. Absolutely, good point !
Show quote "Russell" <russ***@goisc.com> wrote in message news:1145279913.465733.301470@u72g2000cwu.googlegroups.com... > Parameters will also prevent any possible "Sql Injection"attack, as > something that would be an executable statement if inlined is simply > text if it's a parameter value. > |
|||||||||||||||||||||||