Hello all the experts here.
I am trying to do something very simple and can’t get it right, blame it to my non technical background, but i am keen to learn.
So
- I am reading a table
- writing to a listbox
I am using MBS sql plugin and using the graffiti listbox.
the third step
as I read the table and populate the list, I want to also write to another DB table.
and the code looks like below - now io keep getting command out of sync error.
I am just trying to populate a table as i read from one table, very basic, not sure what i am doing is wrong here, but this should be starightforward in any programming.
// fetch results row by row and print results*********************
while cmd.FetchNext
dim field1 as string = cmd.Field(“fld1”).asStringValue
dim field2 as string = cmd.Field(“fld2”).asStringValue
dim field3 as string = cmd.Field(“fld3”).asStringValue
//Load the listbox*********************************
me.AddRow( Str(field1), str(field2), str(field3))
cmdi = new SQLCommandMBS
// Insert row*********************************************
cmdi = new SQLCommandMBS(app.con, “Insert into tbl1 (xfield1, xfield2, xfeidl3) values(‘1’, ‘2’, ‘3’)”)
// Insert row
cmdi.Execute
// commit changes on success
app.con.Commit
'MsgBox “Input parameters bound, rows inserted!”
wend
Thanks
Wahed
5 posts - 3 participants