Skip to Content
0
Former Member
Jun 03, 2008 at 10:40 AM

Loop Problem

48 Views

rs4 = objCompany.GetBusinessObject(BoObjectTypes.BoRecordset)

rs4.DoQuery("select distinct code from oalr where code > '" & AlertCode & "' and code<=('" & code & "') ")

'For i = 0 To rs4.RecordCount

' rs4.DoQuery("select code from oalr where code > '3535' and code<='3535' ")

Ocode = CStr(rs4.Fields.Item(0).Value)

Do Until rs4.EoF = True

rs2 = objCompany.GetBusinessObject(BoObjectTypes.BoRecordset)

rs2.DoQuery("select A.code,A.MsgData,B.UserSign,C.Portnum as MobileNum from OALR A inner join ALT1 B on A.Tcode=B.code inner join OUSR c on C.UserID=B.UserSign where A.code='" & Trim(Ocode) & "' ")

' rs2.DoQuery("select A.code,A.MsgData,B.UserSign,C.Portnum as MobileNum from OALR A inner join ALT1 B on A.Tcode=B.code inner join OUSR c on C.UserID=B.UserSign where A.code='" & Trim(field) & "' ")

code = CStr(rs2.Fields.Item(0).Value)

MsgData = CStr(rs2.Fields.Item(1).Value)

UserSign = CStr(rs2.Fields.Item(2).Value)

MobileNo = CStr(rs2.Fields.Item(3).Value)

If MobileNo <> "NA" Then

rs5 = objCompany.GetBusinessObject(BoObjectTypes.BoRecordset)

'rs5.DoQuery("insert into [@smsmaster](docentry,code,UserSign,u_modulecode,u_categorycode,u_taskid,u_createddt,u_sentdt,u_mobileno,u_message,u_bulksms,u_sentflag,u_statusreport,u_smsno,u_custname,u_lcode) values('" & DocNo & "','" & code & "','" & UserSign & "','ots','','10','" & DtSms & "','" & DtSms & "','" & MobileNo & "','" & MsgData & "','" & DocNo & "','No','No','" & DocNo & "','" & UserSign & "','')")

rs5.DoQuery("insert into [@smsmaster](docentry,code,UserSign,u_modulecode,u_categorycode,u_taskid,u_createddt,u_sentdt,u_mobileno,u_message,u_bulksms,u_sentflag,u_statusreport,u_smsno,u_custname,u_lcode) values('" & DocNo & "','" & code & "','" & UserSign & "','ots','','10','" & DtSms & "','" & DtSms & "','" & MobileNo & "','THANKSForsms','" & DocNo & "','No','No','" & DocNo & "','" & UserSign & "','')")

End If

rs4.MoveNext()

Loop

i m tried this coding rs4 get the first value only its not get the secon value ,so first value going to insert one more time means its create the duplicate value problem..

Tak eg : in my O code i have 1,2,3,4 values means

it takes 1 value only continuous loop not get the second valu e how to solve this problem pls any one help me to solve this problem

BY

SHANMUGAM