Inserting in to a SQL Server Database 
Author Message
 Inserting in to a SQL Server Database

I am wondering if I can do this. I want to add 1 record to my Database.
Instead of filling a Dataset , adding the row then calling Updatemethod. Can
I just use a Blank typed Dataset add the row then call update?

Ben



Sat, 08 May 2004 07:27:07 GMT  
 Inserting in to a SQL Server Database
I don't quite understand your question -- you want to add a row to a
Dataset?

--

Josh Mitts
Microsoft .NET MVP (.NET Framework, C#, .NET CF/SDE)

http://www.joshmitts.com


I am wondering if I can do this. I want to add 1 record to my Database.
Instead of filling a Dataset , adding the row then calling Updatemethod. Can
I just use a Blank typed Dataset add the row then call update?

Ben



Sat, 08 May 2004 11:52:37 GMT  
 Inserting in to a SQL Server Database
I want to insert in this example one to five rows row into the Database. My
database on the other hand has say 10K entries. What I want to know is
rather than populate the Dataset with 10K records then add to the dataset my
1 to 5 new record(s) then update the database using the Data adapter's
update method, Can I just create a new dataset add the 1 -5  new records and
call the update method for the dataadapter's update method without worry?
Will this method erase all of my data or is the Update method smart enough
not to delete the data already stored in the database (but not downloaded to
the Dataset).


Quote:
> I don't quite understand your question -- you want to add a row to a
> Dataset?

> --

> Josh Mitts
> Microsoft .NET MVP (.NET Framework, C#, .NET CF/SDE)

> http://www.joshmitts.com



> I am wondering if I can do this. I want to add 1 record to my Database.
> Instead of filling a Dataset , adding the row then calling Updatemethod.
Can
> I just use a Blank typed Dataset add the row then call update?

> Ben



Sat, 08 May 2004 12:23:00 GMT  
 Inserting in to a SQL Server Database
I would make sure you populate the Dataset first.

--

Josh Mitts
Microsoft .NET MVP (.NET Framework, C#, .NET CF/SDE)

http://www.joshmitts.com


I want to insert in this example one to five rows row into the Database. My
database on the other hand has say 10K entries. What I want to know is
rather than populate the Dataset with 10K records then add to the dataset my
1 to 5 new record(s) then update the database using the Data adapter's
update method, Can I just create a new dataset add the 1 -5  new records and
call the update method for the dataadapter's update method without worry?
Will this method erase all of my data or is the Update method smart enough
not to delete the data already stored in the database (but not downloaded to
the Dataset).


Quote:
> I don't quite understand your question -- you want to add a row to a
> Dataset?

> --

> Josh Mitts
> Microsoft .NET MVP (.NET Framework, C#, .NET CF/SDE)

> http://www.joshmitts.com



> I am wondering if I can do this. I want to add 1 record to my Database.
> Instead of filling a Dataset , adding the row then calling Updatemethod.
Can
> I just use a Blank typed Dataset add the row then call update?

> Ben



Sat, 08 May 2004 23:50:37 GMT  
 Inserting in to a SQL Server Database
Hi Benjamin,

    Yes, you can.

Regards,
Dan


Quote:
> I am wondering if I can do this. I want to add 1 record to my Database.
> Instead of filling a Dataset , adding the row then calling Updatemethod.
Can
> I just use a Blank typed Dataset add the row then call update?

> Ben



Sun, 09 May 2004 02:31:01 GMT  
 Inserting in to a SQL Server Database
Why do you say that he should populate the dataset first?  Isn't that just
time consuming?

Thanks,

Alex



Quote:
> I would make sure you populate the Dataset first.

> --

> Josh Mitts
> Microsoft .NET MVP (.NET Framework, C#, .NET CF/SDE)

> http://www.joshmitts.com



> I want to insert in this example one to five rows row into the Database.
My
> database on the other hand has say 10K entries. What I want to know is
> rather than populate the Dataset with 10K records then add to the dataset
my
> 1 to 5 new record(s) then update the database using the Data adapter's
> update method, Can I just create a new dataset add the 1 -5  new records
and
> call the update method for the dataadapter's update method without worry?
> Will this method erase all of my data or is the Update method smart enough
> not to delete the data already stored in the database (but not downloaded
to
> the Dataset).


> > I don't quite understand your question -- you want to add a row to a
> > Dataset?

> > --

> > Josh Mitts
> > Microsoft .NET MVP (.NET Framework, C#, .NET CF/SDE)

> > http://www.joshmitts.com



> > I am wondering if I can do this. I want to add 1 record to my Database.
> > Instead of filling a Dataset , adding the row then calling Updatemethod.
> Can
> > I just use a Blank typed Dataset add the row then call update?

> > Ben



Sun, 09 May 2004 04:06:46 GMT  
 Inserting in to a SQL Server Database
Why use a dataset at all.  Insert the records via T-Sql  (Insert X,Y,z...)

Quote:
> I am wondering if I can do this. I want to add 1 record to my Database.
> Instead of filling a Dataset , adding the row then calling Updatemethod.
Can
> I just use a Blank typed Dataset add the row then call update?

> Ben



Sun, 09 May 2004 23:16:05 GMT  
 Inserting in to a SQL Server Database
Yes you can,

Look at the SqlCommand.ExecuteNonQuery() Method.

Jim


Quote:
> I am wondering if I can do this. I want to add 1 record to my Database.
> Instead of filling a Dataset , adding the row then calling Updatemethod.
Can
> I just use a Blank typed Dataset add the row then call update?

> Ben



Sat, 15 May 2004 00:30:46 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Inserting Muliple Records into SQL-SERVER Database

2. Database SQL INSERT

3. Using sql to insert data into Access database

4. Problem inserting data in SQL database

5. Insert data into Access database using sql

6. Trying to insert data into SQL Server

7. SQL Server: Slow INSERT performance??

8. Inserting a Delimited Text File into SQL Server

9. Insert in SQL Server CTable<CDynamicAccessor>

10. OLEDB, Fail Insert, SQL Server 7

11. How to insert an image into SQL Server?

12. Inserting a Delimited Text File into SQL Server

 

 
Powered by phpBB® Forum Software