Hi,
If you are using SQL Server, Query the table Data in ISQL/W Or Enterprise Manager's Query Tool..
REgards
Veena
Please Check the code
Collapse
X
-
Ok,but im using sql server...the same can be done here too???Originally posted by QVeen72Hi,
if you are using Access, Open the Access, and Find how many records are thre in EmpDetail and SalDetail Tables, and ow many of them Match (having same EmpID)
Regards
Veena
NICKLeave a comment:
-
Hi,
If you are using Access, Open the Access, and Find how many records are thre in EmpDetail and SalDetail Tables, and ow many of them Match (having same EmpID)
Regards
VeenaLeave a comment:
-
Veena,i couldnt understand,what u have pointed out and the method suggested"Originally posted by QVeen72Hi,
After looking at your Code, I feel that, You Query for EmpID, If No Record is found, then You add /Insert One Record. So at any given time, Only one Related EmpID is there in the Detail Table. So the ListView Shows only one Record.. Any kind of Re-Freshing the RecordSet will fetch you only One Record.
You can Cross-Check by Actual Querying the data in the Table
Regards
Veena
You can Cross-Check by Actual Querying the data in the Table "
Please explain and the code for adding records are:
[code=vb]
rs.Open "select * from empdetail Where ID='" & txtid.Text & "'", conn, adOpenStatic, adLockOptimisti c
If rs.EOF Then
conn.BeginTrans
conn.Execute "insert into empdetail(id,na me,whours,rate, otrate) values ('" & txtid & "','" & txtname & "','" & txtwhr & "','" & txtrate & "','" & txtorate & "')"
conn.CommitTran s
MsgBox "INSERTED NEW RECORDS", vbOKOnly, "ADDING NEW RECORDS"
Else
'ID Found In DB (Duplicate)
MsgBox "Duplicate Entry"
End If
[/code]
NickLeave a comment:
-
rs.requery is not working i have tried this,but i dont think there's a option for refreshing in sql...if any please suggestOriginally posted by debasisdastry to use this
[code=vb]
rs.Requery
[/code]
NICKLeave a comment:
-
Hi,
After looking at your Code, I feel that, You Query for EmpID, If No Record is found, then You add /Insert One Record. So at any given time, Only one Related EmpID is there in the Detail Table. So the ListView Shows only one Record.. Any kind of Re-Freshing the RecordSet will fetch you only One Record.
You can Cross-Check by Actual Querying the data in the Table
Regards
VeenaLeave a comment:
-
Hello
try this
Code:if Rs.state =1 then rs.close
Originally posted by Vbbeginner07not two recordsets are opened at the sametime,n tell me how a sql recoredset be refreshed???tel l me the code to refersh
NICKLeave a comment:
-
not two recordsets are opened at the sametime,n tell me how a sql recoredset be refreshed???tel l me the code to refershOriginally posted by debasisdasIf both of your forms are opened at the same time you need to fresh the recordset in form2 after adding the recods in form1.
NICKLeave a comment:
-
If both of your forms are opened at the same time you need to fresh the recordset in form2 after adding the recods in form1.Leave a comment:
-
Debasis,its not working........ .Originally posted by Vbbeginner07Debasis,its not working........ .
Please go through my code n please suggest......
Nick
Please go through my code n please suggest......
it allows only the first records being added,if we checks form2 that will be displayed,but if we add any records second time it is not displayedLeave a comment:
-
Debasis not working........ .Originally posted by debasisdastry using this
[code=vb]
conn.begintrans
conn.Execute "insert into empdetail(id,na me,whours,rate, otrate) values ('" & txtid & "','" & txtname & "','" & txtwhr & "','" & txtrate & "','" & txtorate & "')"
conn.commitrans
[/code]
Please go through my code n please suggest......
NickLeave a comment:
-
try using this
[code=vb]
conn.begintrans
conn.Execute "insert into empdetail(id,na me,whours,rate, otrate) values ('" & txtid & "','" & txtname & "','" & txtwhr & "','" & txtrate & "','" & txtorate & "')"
conn.commitrans
[/code]Leave a comment:
-
Please Check the code
THE FOLLOWING CODE INSERTS A PARTICULAR DATA INTO THE recordset WHICH IS THE FIRST FORM!!!
[code=vb]
rs.Open "select * from empdetail Where ID='" & txtid.Text & "'", conn, adOpenStatic, adLockOptimisti c
If rs.EOF Then
conn.Execute "insert into empdetail(id,na me,whours,rate, otrate) values ('" & txtid & "','" & txtname & "','" & txtwhr & "','" & txtrate & "','" & txtorate & "')"
MsgBox "INSERTED NEW RECORDS", vbOKOnly, "ADDING NEW RECORDS"
Else
[/code]
THE SECONF FORM CONTAINS A LISTVIEW ,WHICH HAS TO DISPLAY THE RECORDS saved through FORM 1
[code=vb]
rs.Open "select distinct empdetail.name, saldetail1.id from empdetail,salde tail1 where saldetail1.id = empdetail.id", conn, adOpenStatic, adLockOptimisti c
If Not rs.EOF Then
rs.MoveFirst
Do While Not rs.EOF
With ListView1
Set lvitem = ListView1.ListI tems.Add(, , rs!id)
lvitem.SubItems (1) = rs!Name
rs.MoveNext
End With
Loop
End If
rs.Close
Set rs = Nothing
ListView1.Refre sh
ListView2.Refre sh
[/code]
BUT THAT IS NOT WORKING!~!!!,
the code displays only the first inserted record in ht listview,but htt nexrt added records is not dispalying
PLEASE SUGGEST<THNAKS IN ADVANCE!!!Tags: None
Leave a comment: