PC Review


Reply
Thread Tools Rate Thread

Strongly Typed Data Set InsertCommand not working

 
 
mark6139@yahoo.com
Guest
Posts: n/a
 
      16th Apr 2005
I have created a strongly typed dataset in C# using "Generate DataSet"
from the schema viewer/designer in Visual Studio .Net 2003. And I'm
using this in a Windows Forms application.

The database is an Access file.

I have created the associated data adapter and added an insert command
using the command builder wizard.

The resulting code for the insert command looks like this:

//---------------
this.simsInsertCommand.CommandText = "INSERT INTO Sims(simNum,
simTitle) VALUES (?, ?)";
this.simsInsertCommand.Connection = this.conContent;
this.simsInsertCommand.Parameters.Add(new
System.Data.OleDb.OleDbParameter( "simNum",
System.Data.OleDb.OleDbType.Integer, 0, "simNum"));
this.simsInsertCommand.Parameters.Add(
new System.Data.OleDb.OleDbParameter("simTitle",
System.Data.OleDb.OleDbType.VarWChar, 50, "simTitle"));
this.dtaSims.InsertCommand = this.simsInsertCommand;
//----------------

And my code for testing purposes to create a new row and update it in
the database:

//--------------------
dtsSims.SimsRow sr =
(dtsSims.SimsRow)dataSetInstance.Sims.NewSimsRow();
sr.BeginEdit();
sr.simNum = 33;//this is an auto number column and it also doesn't
work if
//I leave this out
sr.simTitle = "Test case";
sr.EndEdit();

dtaSims.Update(dataSetInstance.Sims);
//-------------------------------------

I get no error but also see no change to the database.

Could someone please tell me what I am missing?

Thanks for any suggestions,

Mark

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
what is meant by typed/untyped/strongly typed datasets? Rachana Microsoft VB .NET 4 14th Nov 2007 08:11 PM
Return Strongly Typed Data Set from Web Service HardBap Microsoft ASP .NET 1 30th Jun 2005 02:12 PM
Strongly Typed DataSet Vs Un-Typed Dataset =?Utf-8?B?Sm9iIExvdA==?= Microsoft Dot NET 1 5th May 2005 08:43 AM
Strongly Typed Data Set InsertCommand not working mark6139@yahoo.com Microsoft ADO .NET 3 16th Apr 2005 06:33 PM
Cast weakly typed DataSet to a strongly typed dataset??? Microsoft Dot NET 0 18th Sep 2003 10:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:45 PM.