Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Adding new row to SQL Server 2005 database

 
   Database Help (Home) -> Programming RSS
Next:  job offerings  
Author Message
TAC

External


Since: Nov 30, 2006
Posts: 1



(Msg. 1) Posted: Wed Feb 21, 2007 3:25 pm
Post subject: Adding new row to SQL Server 2005 database
Archived from groups: microsoft>public>sqlserver>programming (more info?)

I am new to SQL Server 2005. I have a large database table, and I want to
add new rows (records) to the table from within a C# program. The simplest
method would seem to be using a T-SQL INSERT command, but T-SQL does not
accept variables as input (only immediate values).



I can also use an SQL DataAdapter and a DataSet, which I use to read subsets
of data, but to add a new row to a large database would create an
unnecessarily large in-memory cache of the data just to add a new row.



What is the simplest way to add a new row to an SQL database table, from
within a C# program, using variables as inputs to each of the column values?



Thanks for any help.

 >> Stay informed about: Adding new row to SQL Server 2005 database 
Back to top
Login to vote
Mike C#

External


Since: Jan 12, 2008
Posts: 483



(Msg. 2) Posted: Wed Feb 21, 2007 3:33 pm
Post subject: Re: Adding new row to SQL Server 2005 database [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Use a parameterized INSERT statement. Parameterized queries are
demonstrated here: http://msdn2.microsoft.com/en-us/library/ms998271.aspx
about halfway down the page.

"TAC" wrote in message

>I am new to SQL Server 2005. I have a large database table, and I want to
>add new rows (records) to the table from within a C# program. The simplest
>method would seem to be using a T-SQL INSERT command, but T-SQL does not
>accept variables as input (only immediate values).
>
>
>
> I can also use an SQL DataAdapter and a DataSet, which I use to read
> subsets of data, but to add a new row to a large database would create an
> unnecessarily large in-memory cache of the data just to add a new row.
>
>
>
> What is the simplest way to add a new row to an SQL database table, from
> within a C# program, using variables as inputs to each of the column
> values?
>
>
>
> Thanks for any help.
>
>
>

 >> Stay informed about: Adding new row to SQL Server 2005 database 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Connecting to Oracle Database within SQL Server 2005 - I have a Oracle Legacy 8.1.6 DB I am trying to connect to via SQL Server 2005. My SQL server is a 64 bit machine. I have successfully connected to the database via System DSN Connection using Oracle OLE connection. I have tried the following other..

Database Restore Problem SQL Server 2005 - Hi OS Windows server 2003 SP1 SQL Server 2005 Slandered Edition We try to restore the backup from the bak file and it is giving the following message System.Data.SqlClient.SqlError : Restore Detected an error on page (0:0) in database "Database...

query for inventory of database information fom master on .. - HI, is it possible to write a query to get the following information for all user defined databases on a given instance of sql server 2005? db size, log / data files , recovery mode, coalition, compatibility level, number of log / data files. ....

Adding images to the database - Looking for an idea here. I've got a .Net app connecting to SQL2005 where I allow users to add pictures to the database. But I don't want them adding gigantic images, so I'm looking for an idea on how to control how big of an image they might add. I'm...

SQL Server 2005 Reporting 2000 to 2005 - Hello I have some databases on sql 2000 Developer Ed SP4 version 8.00.2039 and it work with reporting services Developer Ed version 8.0.1038.00. I need upgrade it to sql2005 and reporting services 2005 too SP2. But I want to do upgrade without..
   Database Help (Home) -> Programming All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]