Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Validate Dataset

Hi everybody!
I have data already in a database table. I am using MS SQL server 2000 as a backend and use VB 6.0 as a front end. Now I want to validate the dataset as in write a code that will check for inconsistencies in that table.

For example, for a person to be married, he/she must be > 15 years.

If married=1 and age < 15 then , too young to be married. I want to dispaly the Id for that particula record and then send it to the .txt file where I will be able to have the hard copy and then I can do the changes.

This I have to do for a very big file


Comments

  • Termc1224Termc1224 Member Posts: 84
    : Hi everybody!
    : I have data already in a database table. I am using MS SQL server 2000 as a backend and use VB 6.0 as a front end. Now I want to validate the dataset as in write a code that will check for inconsistencies in that table.
    :
    : For example, for a person to be married, he/she must be > 15 years.
    :
    : If married=1 and age < 15 then , too young to be married. I want to dispaly the Id for that particula record and then send it to the .txt file where I will be able to have the hard copy and then I can do the changes.
    :
    : This I have to do for a very big file

    dim conn as new adodb.connection
    dim rs as new adodb.recordset

    use a richtextbox control then name it to rtb

    in the form load event
    conn_dept.CursorLocation = adUseClient
    conn_dept.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=HR Data;Data Source=" & hostname
    rs.open sqltxt, conn, adOpenDynamic, adLockOptimistic
    rtb.text = ""
    while not rs.eof
    if rs!married = 1 and age <= 15 then
    if rtb.text = "" then
    rtb.text = rs!id
    else
    rtb.text = rtb.text & vbnewline & rs!id
    end if
    end if
    wend
    then use a commondialog control and name it to cd
    place a commandbutton
    and in your command button click event
    cd.showsave
    rtb.savefile cd.filename
  • PhokojoePhokojoe Member Posts: 10
    : : Hi everybody!
    : : I have data already in a database table. I am using MS SQL server 2000 as a backend and use VB 6.0 as a front end. Now I want to validate the dataset as in write a code that will check for inconsistencies in that table.
    : :
    : : For example, for a person to be married, he/she must be > 15 years.
    : :
    : : If married=1 and age < 15 then , too young to be married. I want to dispaly the Id for that particula record and then send it to the .txt file where I will be able to have the hard copy and then I can do the changes.
    : :
    : : This I have to do for a very big file
    :
    : dim conn as new adodb.connection
    : dim rs as new adodb.recordset
    :
    : use a richtextbox control then name it to rtb
    :
    : in the form load event
    : conn_dept.CursorLocation = adUseClient
    : conn_dept.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=HR Data;Data Source=" & hostname
    : rs.open sqltxt, conn, adOpenDynamic, adLockOptimistic
    : rtb.text = ""
    : while not rs.eof
    : if rs!married = 1 and age <= 15 then
    : if rtb.text = "" then
    : rtb.text = rs!id
    : else
    : rtb.text = rtb.text & vbnewline & rs!id
    : end if
    : end if
    : wend
    : then use a commondialog control and name it to cd
    : place a commandbutton
    : and in your command button click event
    : cd.showsave
    : rtb.savefile cd.filename
    : ----------

    Thanks a lot!

    I have done everything you have said.

    The problem is that when I run the program, it hangs. What could cauze this!


  • Termc1224Termc1224 Member Posts: 84
    : : : Hi everybody!
    : : : I have data already in a database table. I am using MS SQL server 2000 as a backend and use VB 6.0 as a front end. Now I want to validate the dataset as in write a code that will check for inconsistencies in that table.
    : : :
    : : : For example, for a person to be married, he/she must be > 15 years.
    : : :
    : : : If married=1 and age < 15 then , too young to be married. I want to dispaly the Id for that particula record and then send it to the .txt file where I will be able to have the hard copy and then I can do the changes.
    : : :
    : : : This I have to do for a very big file
    : :
    : : dim conn as new adodb.connection
    : : dim rs as new adodb.recordset
    : :
    : : use a richtextbox control then name it to rtb
    : :
    : : in the form load event
    : : conn_dept.CursorLocation = adUseClient
    : : conn_dept.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=HR Data;Data Source=" & hostname
    : : rs.open sqltxt, conn, adOpenDynamic, adLockOptimistic
    : : rtb.text = ""
    : : while not rs.eof
    : : if rs!married = 1 and age <= 15 then
    : : if rtb.text = "" then
    : : rtb.text = rs!id
    : : else
    : : rtb.text = rtb.text & vbnewline & rs!id
    : : end if
    : : end if
    : : wend
    : : then use a commondialog control and name it to cd
    : : place a commandbutton
    : : and in your command button click event
    : : cd.showsave
    : : rtb.savefile cd.filename
    : : ----------
    :
    : Thanks a lot!
    :
    : I have done everything you have said.
    :
    : The problem is that when I run the program, it hangs. What could cauze this!
    :
    O i'm sorry i forgot to put this line "rs.movenext".
    place it where i place it

    while not rs.eof
    : : if rs!married = 1 and age <= 15 then
    : : if rtb.text = "" then
    : : rtb.text = rs!id
    : : else
    : : rtb.text = rtb.text & vbnewline & rs!id
    : : end if
    : : end if
    rs.movenext
    wend

  • PhokojoePhokojoe Member Posts: 10
    : : : : Hi everybody!
    : : : : I have data already in a database table. I am using MS SQL server 2000 as a backend and use VB 6.0 as a front end. Now I want to validate the dataset as in write a code that will check for inconsistencies in that table.
    : : : :
    : : : : For example, for a person to be married, he/she must be > 15 years.
    : : : :
    : : : : If married=1 and age < 15 then , too young to be married. I want to dispaly the Id for that particula record and then send it to the .txt file where I will be able to have the hard copy and then I can do the changes.
    : : : :
    : : : : This I have to do for a very big file
    : : :
    : : : dim conn as new adodb.connection
    : : : dim rs as new adodb.recordset
    : : :
    : : : use a richtextbox control then name it to rtb
    : : :
    : : : in the form load event
    : : : conn_dept.CursorLocation = adUseClient
    : : : conn_dept.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=HR Data;Data Source=" & hostname
    : : : rs.open sqltxt, conn, adOpenDynamic, adLockOptimistic
    : : : rtb.text = ""
    : : : while not rs.eof
    : : : if rs!married = 1 and age <= 15 then
    : : : if rtb.text = "" then
    : : : rtb.text = rs!id
    : : : else
    : : : rtb.text = rtb.text & vbnewline & rs!id
    : : : end if
    : : : end if
    : : : wend
    : : : then use a commondialog control and name it to cd
    : : : place a commandbutton
    : : : and in your command button click event
    : : : cd.showsave
    : : : rtb.savefile cd.filename
    : : : ----------
    : :
    : : Thanks a lot!
    : :
    : : I have done everything you have said.
    : :
    : : The problem is that when I run the program, it hangs. What could cauze this!
    : :
    : O i'm sorry i forgot to put this line "rs.movenext".
    : place it where i place it
    :
    : while not rs.eof
    : : : if rs!married = 1 and age <= 15 then
    : : : if rtb.text = "" then
    : : : rtb.text = rs!id
    : : : else
    : : : rtb.text = rtb.text & vbnewline & rs!id
    : : : end if
    : : : end if
    : rs.movenext
    : wend
    :
    : ------------------------------------------------
    Thanks a lot. It works exept that I have seen the fucntion wend many times but I do not understand how it works. One more thing,
    for the purposes of testing I have entered 1 record which I wanted to check for the inconsistencies between marriage and age and the ID displayed is id number 3 and it displays that in a txt file that I have specified, the strange thing is that it gives me some funny text before the id.

    Check the file below

    {
    tf1ansideff0{fonttbl{f0fnilfcharset0 Verdana;}}
    viewkind4uc1pardlang1033f0fs20 3
    par }

    why is it doing this?

    Suppose I want to display the message next to the id say:

    Id message
    3 Too young to get married

    How do I go about with that. I tried to do it but failed. however, I am still trying to come upt with that.

    Thanks again for helping.

    Actually, I am new in VB.


  • Termc1224Termc1224 Member Posts: 84
    : : : : : Hi everybody!
    : : : : : I have data already in a database table. I am using MS SQL server 2000 as a backend and use VB 6.0 as a front end. Now I want to validate the dataset as in write a code that will check for inconsistencies in that table.
    : : : : :
    : : : : : For example, for a person to be married, he/she must be > 15 years.
    : : : : :
    : : : : : If married=1 and age < 15 then , too young to be married. I want to dispaly the Id for that particula record and then send it to the .txt file where I will be able to have the hard copy and then I can do the changes.
    : : : : :
    : : : : : This I have to do for a very big file
    : : : :
    : : : : dim conn as new adodb.connection
    : : : : dim rs as new adodb.recordset
    : : : :
    : : : : use a richtextbox control then name it to rtb
    : : : :
    : : : : in the form load event
    : : : : conn_dept.CursorLocation = adUseClient
    : : : : conn_dept.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=HR Data;Data Source=" & hostname
    : : : : rs.open sqltxt, conn, adOpenDynamic, adLockOptimistic
    : : : : rtb.text = ""
    : : : : while not rs.eof
    : : : : if rs!married = 1 and age <= 15 then
    : : : : if rtb.text = "" then
    : : : : rtb.text = rs!id
    : : : : else
    : : : : rtb.text = rtb.text & vbnewline & rs!id
    : : : : end if
    : : : : end if
    : : : : wend
    : : : : then use a commondialog control and name it to cd
    : : : : place a commandbutton
    : : : : and in your command button click event
    : : : : cd.showsave
    : : : : rtb.savefile cd.filename
    : : : : ----------
    : : :
    : : : Thanks a lot!
    : : :
    : : : I have done everything you have said.
    : : :
    : : : The problem is that when I run the program, it hangs. What could cauze this!
    : : :
    : : O i'm sorry i forgot to put this line "rs.movenext".
    : : place it where i place it
    : :
    : : while not rs.eof
    : : : : if rs!married = 1 and age <= 15 then
    : : : : if rtb.text = "" then
    : : : : rtb.text = rs!id
    : : : : else
    : : : : rtb.text = rtb.text & vbnewline & rs!id
    : : : : end if
    : : : : end if
    : : rs.movenext
    : : wend
    : :
    : : ------------------------------------------------
    : Thanks a lot. It works exept that I have seen the fucntion wend many times but I do not understand how it works. One more thing,
    : for the purposes of testing I have entered 1 record which I wanted to check for the inconsistencies between marriage and age and the ID displayed is id number 3 and it displays that in a txt file that I have specified, the strange thing is that it gives me some funny text before the id.
    :
    : Check the file below
    :
    : {
    tf1ansideff0{fonttbl{f0fnilfcharset0 Verdana;}}
    : viewkind4uc1pardlang1033f0fs20 3
    : par }
    :
    : why is it doing this?
    :
    : Suppose I want to display the message next to the id say:
    :
    : Id message
    : 3 Too young to get married
    :
    : How do I go about with that. I tried to do it but failed. however, I am still trying to come upt with that.
    :
    : Thanks again for helping.
    :
    : Actually, I am new in VB.
    :
    :
    : For your first question, wend is where the point that tells the computer to jump back at while statement and exit if the condition are not met, and repeat the command between while and wend statement if true. short for while end.
    for second problem. in your common dialog control select filter and put this "Word Files|*.doc", this way it will format it in word document file, no need to put the ext name.
    For the third just place this after the rs!id, sample
    rtb.text = rtb.text & vbnewline & rs!id & " to young to get married"

  • PhokojoePhokojoe Member Posts: 10
    : : : : : : Hi everybody!
    : : : : : : I have data already in a database table. I am using MS SQL server 2000 as a backend and use VB 6.0 as a front end. Now I want to validate the dataset as in write a code that will check for inconsistencies in that table.
    : : : : : :
    : : : : : : For example, for a person to be married, he/she must be > 15 years.
    : : : : : :
    : : : : : : If married=1 and age < 15 then , too young to be married. I want to dispaly the Id for that particula record and then send it to the .txt file where I will be able to have the hard copy and then I can do the changes.
    : : : : : :
    : : : : : : This I have to do for a very big file
    : : : : :
    : : : : : dim conn as new adodb.connection
    : : : : : dim rs as new adodb.recordset
    : : : : :
    : : : : : use a richtextbox control then name it to rtb
    : : : : :
    : : : : : in the form load event
    : : : : : conn_dept.CursorLocation = adUseClient
    : : : : : conn_dept.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=HR Data;Data Source=" & hostname
    : : : : : rs.open sqltxt, conn, adOpenDynamic, adLockOptimistic
    : : : : : rtb.text = ""
    : : : : : while not rs.eof
    : : : : : if rs!married = 1 and age <= 15 then
    : : : : : if rtb.text = "" then
    : : : : : rtb.text = rs!id
    : : : : : else
    : : : : : rtb.text = rtb.text & vbnewline & rs!id
    : : : : : end if
    : : : : : end if
    : : : : : wend
    : : : : : then use a commondialog control and name it to cd
    : : : : : place a commandbutton
    : : : : : and in your command button click event
    : : : : : cd.showsave
    : : : : : rtb.savefile cd.filename
    : : : : : ----------
    : : : :
    : : : : Thanks a lot!
    : : : :
    : : : : I have done everything you have said.
    : : : :
    : : : : The problem is that when I run the program, it hangs. What could cauze this!
    : : : :
    : : : O i'm sorry i forgot to put this line "rs.movenext".
    : : : place it where i place it
    : : :
    : : : while not rs.eof
    : : : : : if rs!married = 1 and age <= 15 then
    : : : : : if rtb.text = "" then
    : : : : : rtb.text = rs!id
    : : : : : else
    : : : : : rtb.text = rtb.text & vbnewline & rs!id
    : : : : : end if
    : : : : : end if
    : : : rs.movenext
    : : : wend
    : : :
    : : : ------------------------------------------------
    : : Thanks a lot. It works exept that I have seen the fucntion wend many times but I do not understand how it works. One more thing,
    : : for the purposes of testing I have entered 1 record which I wanted to check for the inconsistencies between marriage and age and the ID displayed is id number 3 and it displays that in a txt file that I have specified, the strange thing is that it gives me some funny text before the id.
    : :
    : : Check the file below
    : :
    : : {
    tf1ansideff0{fonttbl{f0fnilfcharset0 Verdana;}}
    : : viewkind4uc1pardlang1033f0fs20 3
    : : par }
    : :
    : : why is it doing this?
    : :
    : : Suppose I want to display the message next to the id say:
    : :
    : : Id message
    : : 3 Too young to get married
    : :
    : : How do I go about with that. I tried to do it but failed. however, I am still trying to come upt with that.
    : :
    : : Thanks again for helping.
    : :
    : : Actually, I am new in VB.
    : :
    : :
    : : For your first question, wend is where the point that tells the computer to jump back at while statement and exit if the condition are not met, and repeat the command between while and wend statement if true. short for while end.
    : for second problem. in your common dialog control select filter and put this "Word Files|*.doc", this way it will format it in word document file, no need to put the ext name.
    : For the third just place this after the rs!id, sample
    : rtb.text = rtb.text & vbnewline & rs!id & " to young to get married"
    :
    :
    Thak you very much. It has worked. Let me put more tests and see how I can run this show.

    Thank once again
Sign In or Register to comment.