Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot update textbox
Message
 
To
21/09/2002 18:31:18
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00703115
Message ID:
00703141
Views:
16
Thanks Bonnie, I'm working on it now. I've easily converted it to VB, but still nothing is saved.

In the last lines of your sample you include:

ds = oData.GetChanges();
> // code follows to handle the updates

Well the code to handle the updates is excatly what I'm looking for. I would LOVE to see how you are handling that - in C# or any other .Net language!

Up to that point all my code works. But the update itself continues to fail.

Thanks
Do

>Don,
>
>Not 100% sure, but perhaps you need to issue an EndEdit() for the dataset row. (Hopefully that's the same syntax in VB ... I use C#). Some controls don't seem to automatically do that and others do. I have a call in my Save() method that generically spins through each row in each table in the dataset and issues an EndEdit(). I posted this code in another thread, but it's easier for me to just post it again instead of trying to find the other thread. It goes like this (this is C#, you'll have to substitute the correct VB code):
>
>
>private void EndTheEdit(DataSet ds)
>{
>  for (int nTable = 0; nTable < ds.Tables.Count; nTable++)
>  {
>    for (int nRow = 0; nRow < ds.Tables[nTable].Rows.Count; nRow++)
>    {
>      if (ds.Tables[nTable].Rows[nRow].HasVersion(DataRowVersion.Proposed))
>        ds.Tables[nTable].Rows.[nRow].EndEdit;
>    }
>  }
>}
>
>
>Call this method from your Save() method, like this:
>
>
>private bool Save()
>{
>  DataSet ds;
>  this.EndTheEdit(this.oData);
>  if (this.oData.HasChanges())
>  {
>    ds = oData.GetChanges();
>    // code follows to handle the updates
>  }
>}
>
>
>Sorry to post this in C#, but if I tried to translate it to VB, I'd probably miss something somewhere since I'm not familiar at all with VB. Of course, this may not even be what your problem is, but I'm guessing it might have something to do with it.
>
>HTH,
>~~Bonnie
>
>
>
>>I am learning VB.net, I am an experience VFP programmer.
>>
>>I cannot get a text box bound to a dataset field to update properly.
>>
>>For example, I create the simple Windows form sample based on the Walkthrough, with a grid and a sqlDataAdapter, and it works fine, updates fine.
>>
>>I add a textbox to the same form, select "ds1.Companyname" from the Text dropdown. It populates fine on startup. When I type a different name in the text box, then click on the grid, the grid field changes to the new value, and I can update everything fine.
>>
>>Now I remove the grid and nothing will update. I build the form from scratch and spend several hours on this, to no avail.
>>
>>Can someone help me with updating from textboxes instead of a grid? When I check the dataset value on tracing, it is changing and shows the new value. Where is the reference I need to read?
>>
>>Thanks,
>>Don Meuse
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform