Richard77
Richard77

Reputation: 21641

Is it possible possible to add an object to the ObjectDataSource's InsertParameters collection? [as opposed to a string]

I'm invoking the ObjectDataSource InsertMethod programmatically. I've tried so save a couple of text boxes' value to the DB using the InsertParameters.Add() method, and it worked perfectly.

SqlDataSource1.InsertParameters.Add("CoName", CompanyNameBox.Text);
SqlDataSource1.InsertParameters.Add("Phone", PhoneBox.Text);         
SqlDataSource1.Insert();

Now, given that I have an important number of variables, I've regrouped those variables in one object.

Now, it looks like there's no overload method that allow me to add a parameter accepting an object to the collection.

What the best way to do that? Any other alternative?

Thanks for helping.

Upvotes: 0

Views: 114

Answers (1)

Mr47
Mr47

Reputation: 2655

All your paramaters will have to be provided one by one in your code, that is to say one call to add a parameter per property of your custom object.

Upvotes: 1

Related Questions