cancel
Showing results for 
Search instead for 
Did you mean: 

Sql and recordset in .net

Former Member
0 Kudos

Hi !

I have a RS.DOQUERY that returns about +/- 50 rows. I would like to put the data in my table row by row. I use this

Do While Not RS.EOF
                        Inv = RS.Fields.Item("RSDOC").Value
                        Bp = RS.Fields.Item("RSCRD").Value
                        Dte = RS.Fields.Item("RSDATE").Value
                        Styl = RS.Fields.Item("RSITM").Value

RS.DOQUERY ("INSERT INTO [@TABLE] .......")

RS.MOVENEXT()
LOOP

When i run my code it gives me the error Invalid Row..

Thanks !!

Alain

Accepted Solutions (1)

Accepted Solutions (1)

former_member184566
Active Contributor
0 Kudos

Hi Alain

What i spot here is that you use RS as a recordset, before your "while" you must of called it with your +-50 records. Thats good. But then in your loop i see you have another query to insert values, but this will then clear your +-50 records and then when you say rs.movenext it will give that error because the last query (insert query) did not return any results. Rather use a seperate Recordset for the query that return results and another for inserting Alain.

That should solve the problem.

PS: SAP prefers us using there objects to insert into a table instead of using a Query inside a recordset.But this will work!

Hope this helps

Former Member
0 Kudos

Thanks i'll try to work it out... now i get 50 times the same row in the table so i must be doing something wrong with my second recordset.

Anyway i would prefer to do it like sap recommends... would that be with datasource ? is there a sample in sdk that is close to what i'm trying to do ..

Thanks

p.s: Again i cant allow you points.. !!! i am logged in correctly and i can post. I dont understand why i cant allow you points..

p.s.2: Hey guess what i have 10 points now. I solved someones problem with DTW !!!! lets celebrate hahaha !

Alain

former_member184566
Active Contributor
0 Kudos

CONGRATULATIONS!!!

Answers (0)