Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > Update DataGrid?


Reply
 
Thread Tools Display Modes
  #1  
Old 07-26-2002, 05:42 PM
Code A's Avatar
Code A Code A is offline
Junior Contributor
 
Join Date: Jul 2002
Location: Area 51 A
Posts: 366
Question Update DataGrid?


Oops...I originally posted this in wrong forum

I have an ADODC control bound to DataGrid and I am trying to update it but it will not let me.

Here is an example of my code...any ideas why this doesn't work?

'Connect and Retrieve Data using Jet 4.0


SQL = "SELECT * FROM table WHERE PrimaryID = " & PrimaryID & " ;"
Adodc1.CursorLocation = adUseClient
Adodc1.LockType = adLockOptimistic
Adodc1.CursorType = adOpenStatic
Adodc1.RecordSource = SQL
Adodc1.Refresh

Set DataGrid1.DataSource = Adodc1
DataGrid1.AllowUpdate = True


'Update Datagrid after Edit


Adodc1.Refresh
Datagrid1.Refresh
Reply With Quote
  #2  
Old 07-26-2002, 06:51 PM
Thinker Thinker is offline
Iron-Fisted Programmer

Retired Moderator
* Guru *
 
Join Date: Jul 2001
Location: Fayetteville Arkansas USA
Posts: 18,127
Default

What error do you get, and do you have some code in that tries
to do the update, or are you just relying on navigating to another
record to trigger the update?
__________________
Posting Guidelines
Reply With Quote
  #3  
Old 07-26-2002, 07:05 PM
Code A's Avatar
Code A Code A is offline
Junior Contributor
 
Join Date: Jul 2002
Location: Area 51 A
Posts: 366
Default

i was relying on it automatically updating. i thought that was how .allowupdate worked, no?

how do you get the contents of the cell to manually add the update by code?

btw, i'm not getting any errors. it's just not accepting the update in the database.
Reply With Quote
  #4  
Old 07-26-2002, 07:13 PM
Thinker Thinker is offline
Iron-Fisted Programmer

Retired Moderator
* Guru *
 
Join Date: Jul 2001
Location: Fayetteville Arkansas USA
Posts: 18,127
Default

The allowupdate means it allows update, but for the update to
happen, you would need to navigate to a different row.
__________________
Posting Guidelines
Reply With Quote
  #5  
Old 07-27-2002, 12:23 PM
vikky17
Guest
 
Posts: n/a
Default

Allowupdate method will just allow the datgrid to be updated if you want to upodate the the database you will have tp directlysave the Recordset by picking it upo fro the adodc
Reply With Quote
  #6  
Old 07-27-2002, 06:02 PM
Code A's Avatar
Code A Code A is offline
Junior Contributor
 
Join Date: Jul 2002
Location: Area 51 A
Posts: 366
Default

OK, ignore my first post.

New question....

How do I grab the text out of a cell of a datagrid? is this possible?

I have a datagrid set up with only 4 columns and 1 row. If the user enters data into a field, can i grab the data out of the cell...OR how do navigate the next row if there is only 1 record?

Thanks

Last edited by Code A; 07-28-2002 at 08:21 AM.
Reply With Quote
  #7  
Old 07-28-2002, 01:24 PM
praveensg's Avatar
praveensg praveensg is offline
Junior Contributor
 
Join Date: May 2002
Location: Planet VB
Posts: 359
Default

u can use the cellvalue method i guess
__________________
When the going gets tough, the tough get going!!!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->