Re: add data from a datagrid
- From: "Steve Gerrard" <mynamehere@xxxxxxxxxxx>
- Date: Mon, 7 Jan 2008 19:26:58 -0800
diaExcel wrote:
I have an application in vb 6.0 using ADO and Access, and I try to
add all data from a datagrid in database but I can't. I don't know
what can I do, I use on a form a datagrid, and a commandbutton. The
code of fill out of datagrid is:
With rstincarca
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
End With
sirulSQL = "SELECT * FROM unifi order by area_name asc"
rstincarca.Open sirulSQL, Conex
Set dgImport.DataSource = rstincarca
nRows = rstincarca.RecordCount
First, you might try a simple MoveLast, MoveFirst, right after you open
rstincarca. Otherwise the RecordCount property may not be correct.
Second, ask yourself why you are using adUseServer and adOpenKeyset. A keyset
cursor may not retrieve all the records until they are needed, so RecordCount
might not work correctly.
Another option would be to open a small recordset using
"SELECT COUNT(*) As RecCount FROM unifi"
This would let the database server count up the records, and tell you how many
there were.
.
- Follow-Ups:
- Re: add data from a datagrid
- From: diaExcel
- Re: add data from a datagrid
- References:
- add data from a datagrid
- From: diaExcel
- add data from a datagrid
- Prev by Date: Re: Using .NET web services in VB 6.0
- Next by Date: Re: How to iterate through files ON A NETWORKED DRIVE???
- Previous by thread: add data from a datagrid
- Next by thread: Re: add data from a datagrid
- Index(es):