Forum Discussion

kktsenthil's avatar
kktsenthil
Occasional Contributor
11 years ago

Need Help on Data retrieval from DB and Find the particular value count

Hi All,

 

I need a valuable help please

 

right now i retrieved value from the database and wat to find the field value count

for example

 

User Name: King

i inserted a record in to the DB and want to find is there any existing value(King) stored in the Table(Duplicate value)

Below is Script in VB

So some one help me

 

Qry.SQL = "select * from Test_Main.dbo.tbtable"

Qry.Open

Qry.First
While Not Qry.EOF

columnvalue = Qry.FieldByName("ColumnName").Value

if(StrComp(columnvalue,UsertxtInputName,1)) = 0 then
log.message "Input data stored in the database successfully"
log.message columnvalue
end if
Qry.Next
Wend
' Closes the query
Qry.Close

 

 

5 Replies

    • kktsenthil's avatar
      kktsenthil
      Occasional Contributor

      Yes the code works fine and need to find the duplicate value..

      • leandroaraujoso's avatar
        leandroaraujoso
        Contributor

        Try this:

         

        Qry.SQL = "select * from Test_Main.dbo.tbtable where name_field = 'King'

         

        and then ...

         

        if (Qry.RecordCount > 1)

          Log.Message("There are duplicate records for the query executed.");

         

        Let me know if that helps.

         

        Regards,

         

        Leandro de Araújo Souza