Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data binding error
Message
 
À
03/04/2008 12:00:53
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01307537
Message ID:
01307891
Vues:
10
Ok. In Bonnie's message #1306779 she provided 3 ways to do it. The first said use the Update, which I tried here, and
the other 2 use more in depth approaches. I'm still confused on this.

Can you provide an example of what you're referring to here?



>It's not being saved in the DB because ADO.NET is a disconnected architecture. It is being saved in your dataset, but you will need to write procedures to save that back to the database. Kind of tricky at first, and frustrating, but once you get the hand of it there are definitely benefits.
>
>>Ok, I see.
>>
>>Now I see data in the field. But when I change the data in the textbox, it's not being saved to the DB
>>
>>
>>public void UpdateUser(DataSet oUserData)
>>{
>>
>>    SqlConnection oConnection = _GetConnection();
>>
>>    SqlDataAdapter oDataAdapter = new SqlDataAdapter("select * from AppUsers", oConnection);
>>    SqlCommandBuilder oBuilder = new SqlCommandBuilder(oDataAdapter);
>>
>>    oDataAdapter.Update(oUserData, oUserData.Tables[0].TableName);
>>}
>>
>>
>>When I open the DataSet Visualizer at this point, the change is there. It just doesnt get saved to
>>the database. I think it was Bonnie who mentioned the dataset needing a PK
>>
>>Any thoughts on this?
>>
>>
>>
>>
>>
>>
>>>When you bind, you bind directly to the datatable, not the dataset. The dataset is the object, and the datatable is a collection property of the dataset. You are indexing the first datatable in the collection by using 0 (or you could alternatively use your table name - "UserData"). The actual field name is a property of the datatable. When you used "UserData.FullName", it saw that as the complete field name - not the table.fieldname.
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform