legendgod Posted May 28, 2004 Posted May 28, 2004 some ppl said that we can update the database with dataview directly, so I typed the follwoing codes: Dim dv as new dataview Dim olddv as new dataview olddv = session("dv") ' which I have update it and sort it in other procedure and add it in session for i = 0 to olddv.count-1 dv.AllowEdit = True dv(i).BeginEdit dv(i)("FirstName") = olddv(i)("FirstName") dv(i)("LastName") = olddv(i)("LastName") dv(i).EndEdit next But after running, although no error message it gives no change to database. All updated still appear in session only. Have I type anything wrong? Or I have misunderstand the concept? Thank you. Quote http://blog.legendgod.com
Administrators PlausiblyDamp Posted May 28, 2004 Administrators Posted May 28, 2004 You would still need to call the DataAdapter.Update(....) command to push the changes back to the datasource. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
legendgod Posted May 28, 2004 Author Posted May 28, 2004 Finally I have used commandbuilder to do the same thing. However, I would like to try your suggestion later. Thank you! Quote http://blog.legendgod.com
JABE Posted May 28, 2004 Posted May 28, 2004 Using the commandbuilder automatically generates SQL code (usually bloated) for you. You'll have greater control if you set your INSERT, UPDATE and DELETE commands manually. In any case, you would have to call DataAdapter.Update(...) as mentioned by Plaus. Quote
legendgod Posted May 28, 2004 Author Posted May 28, 2004 Using the commandbuilder automatically generates SQL code (usually bloated) for you. You'll have greater control if you set your INSERT' date=' UPDATE and DELETE commands manually. In any case, you would have to call DataAdapter.Update(...) as mentioned by Plaus.[/quote'] Well... I am newbie for ASP.NET (obviously). Do you mean that using commandbuilder is a better approach or vice versa? Which way give a better performance in access speed and security? Thanks. Quote http://blog.legendgod.com
JABE Posted May 28, 2004 Posted May 28, 2004 I don't use commandbuilder in prod code because I usually don't like the SQL code it produces (and besides, I don't think it works w/ stored procs). I find more control and efficiency in manually setting the SQL commands. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.