473,398 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Inserting info in a table

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
Apr 15 '06 #1
5 806
John,
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?

Assuming you want to do this with a .Net program.

Create a Transact SQL insert string and process that with execute.nonquery

I hope this helps,

Cor
Apr 15 '06 #2
>> what is the best (in terms of being simplest/most straightforward) method

Depends on what you find the simplest. Maybe you could enter the data
in manually ! What could be simpler ! ;-)

Apr 15 '06 #3
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

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net

"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:OZ**************@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

Apr 15 '06 #4
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.

Apr 17 '06 #5
Absolutely, good point !

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
"Russell" <ru*****@goisc.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.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.

Apr 17 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Miranda | last post by:
Hi, I have a ASP/vbscript program that generates random passwords. The problem is I need to insert those passwords into an Access database of 327 clients. I have the random password program...
4
by: Greg Ofiesh | last post by:
Anyone who can help, I have two tables T1 and T2. T1 has fields K1 and F2 and T2 has fields K2 and F1. F1 is the foreign key relating to K1 and F2 is the foreign key relating to K2. My...
2
by: a | last post by:
NEW Post Here's my best guess at how to insert this dataset.... the code runs, but no new records are added to the sql table. I've read and split a delimited text file into a dataset. It...
1
by: Karim | last post by:
I have a form built into an html table. One of the form elements is an asp.net dropdownlist. For some options in the listbox, I want to insert a new table row under the listbox to grab some more...
4
by: Bruno Alexandre | last post by:
Hi guys, I have a web application that insert Clients info into the Database, the Apllication is accesed by several user at the same time, the Client Info is divide by 3 tables (Client, Product...
0
by: pd123 | last post by:
I'm new to C# and .net and I'm trying to create a form that will register users in a sql server database. I have the following code but when I run the code I get an error " The name 'Peter' is...
4
by: Markus | last post by:
Hello I use a table to cache some informations which need lots of resources to be composed. The first time the info is needed, it will be composed and written to the cache table ($db in the...
2
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography...
2
by: cluce | last post by:
I am trying to read a csv file with user info (username, password, email, address, city, zip, state, etc.) I am inserting the username, password, email into the aspnet_memberhsip table using the...
3
by: simple simon | last post by:
How would I insert into multiple related tables using a table valued parameter? Is there any way to do this without using a WHILE loop? I know how to insert from a table valued parameter into one...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.