Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with CommandBuilder
Message
 
To
29/11/2004 17:14:20
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00965146
Message ID:
00965551
Views:
12
Hi Bonnie.

Thanks for that very informative explanation... I see the difference now between fields scoped to the class and scoped to the method !!


Could you assist me in one other area ?
I am trying to delete a record in the Dataset (Which will then be 'Updated' back to the Database)

I have Page one with a Grid, and Page Two which shows each field in the current record as separate fields.

I have a 'Delete' button where I want to delete the 'Current' record, i.e. the record I have currently displayed:

I reckon I should use something like:
oDS.MyTable.Row(x).Delete()
but dont know the value of x (Current Row ?)

Is there some property that tells me the 'Current' row I am on
(A bit liker Recno() I suppose in VFP)

Regards,
Gerard




>Gerard,
>
>They are different because you've already defined oAd in your declarations at the top of your class:
>
>protected OleDbDataAdapter oAd;
>
>That makes this.oAd a variable that can be used throughout your class (but it hasn't as yet been instantiated). When you instantiated oAd in your GetData() method with:
>
>OleDbDataAdapter oAd = new OleDbDataAdapter(this.sSelectString ,oCon);
>
>you are, in effect, creating another variable that is local to the GetData() method and this is not the same as the oAd that was created in the declarations of your class (which is referenced by this.oAd and is scoped globally to the entire class).
>
>By replacing the command as I suggested, you are now instantiating the variable that is scoped to the entire class, rather than one that is scoped only to the method. And, you *do* need this class-scoped variable since you are using it in two different methods.
>
>Do you see the difference between the two now or do I need to explain it differently?
>
>~~Bonnie
>
>
>
>>Hi Bonnie. Many thanks for your reply.
>>That sorted the problem but I dont understand why !!
>>
>>OleDbDataAdapter oAd = new OleDbDataAdapter(this.sSelectString ,oCon);
>> replaced by
>>this.oAd = new OleDbDataAdapter(this.sSelectString ,oCon);
>>
>>Why is there a difference then between the two commands ?
>>Are they both not initialising a New OleDbDataAdapter called oAd ?
>>
>>Regards,
>>
>>Gerard
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform