Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FlexgGrid to ADO Recordset 1

Status
Not open for further replies.

gazal

Programmer
Apr 30, 2003
212
OM
Hi Friends

I want to know, is it possible to prepare a Recordset from the information displayed in a FlexGrid.

Yeah i mean to say that Lets say my FlexGrid is Displaying 10 Rows and 2 Columns, So i want to prepare a Recordset which should contain 2 Fields and 10 Records,

I know i can loop through the Flexgrid, buti have already written so much of code for looping through Recordset, So i dont want to touch the code....

Note i am using, Win2k, VB6 SP5, SQL Server 2000.

Anyhelp will be great...
 
Try something like this:

Dim FinalRs As ADODB.Recordset
Dim i As Long
Set FinalRs = New ADODB.Recordset
With FinalRs
.Fields.Append "UserName", adVarWChar, 50
.Fields.Append "Password", adVarWChar, 50
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Open
End With
For i = 1 To MSFlexGrid1.Rows - 1
With FinalRs
.AddNew
.Fields("UserName") = MSFlexGrid1.TextMatrix(i, 0)
.Fields("Password") = MSFlexGrid1.TextMatrix(i, 1)
.Update
End With
Next

Swi
 
thats great exactly does what i intend to do..

Thanks a lot

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top