Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Exception when saving
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01065248
Message ID:
01065691
Views:
13
Douglas,

I'm not sure why it's throwing an exception...if you don't specify otherwise, the data access class uses the SQLCommandBuilder to generate insert, update, and delete statements from the SELECT statement. I'm not sure if this would fix the problem, but in either case, I recommend using parameterized queries rather than concatenating strings (see the MM .NET Dev Guide topic "Retrieving Data using SQL SELECT Command Strings"...there's a warning about SQL injection).

For example:
public void test(string cidSuggest, DateTime date, int iEntryStepNum)
{

	string cmd = "SELECT cidSuggest, iEntryStepNum, tLastUpd FROM suggest WHERE cidSuggest = @cidSuggest";

	DataSet dsSuggest = GetDataSet(cmd, this.CreateParameter("@cidSuggest, cidSuggest));
	dsSuggest.Tables[0].Rows[0]["iEntryStepNum"] = iEntryStepNum;
	dsSuggest.Tables[0].Rows[0]["tLastUpd"] = DateTime.Now;
	mmSaveDataResult result = SaveDataSet();

	...

}
If this doesn't fix the problem, I recommend setting a breakpoint in mmDataAccessSql.CreateUpdateCommand() to see what's happening.

Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform