visual basic

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chans
    New Member
    • Oct 2007
    • 8

    visual basic

    while without wend error
  • jrtox
    New Member
    • Sep 2007
    • 89

    #2
    Originally posted by chans
    while without wend error

    Used this Format
    Code:
    Dim i as integer
    i = 0
    
    While i < 5 
    
    'Display here
    
    i = i + 1
    Wend
    Regards
    Phils Ervin

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      Originally posted by chans
      while without wend error
      Kindly post the details of the error that you are facing.

      Comment

      • chans
        New Member
        • Oct 2007
        • 8

        #4
        I am a beginner for VB. i am writing a code which has to display details of employee from database. hav a look at my code...

        Private Sub Combo1_click()
        Combo1.AddItem ("1233")
        Combo1.AddItem ("1234")
        Combo1.AddItem ("3343")
        End Sub




        Private Sub Form_Load()

        Dim adoRecordset As ADODB.Recordset
        Dim db As New ADODB.Connectio n
        Dim mDatabaseName As String
        Dim mDBserverName As String
        mDatabaseName = "chandru"
        mDBserverName = "(local)"
        db.Connectionst ring = "Driver={SQ L Server};Provide r=MSDASQL.1;DAT ABASE=" & mDatabaseName & ";uid=sa;pwd=vm s;Server=" & mDBserverName & ";"
        Set adoRecordset = New ADODB.Recordset
        adoRecordset.Op en "select name from employee", db.Connectionst ring


        If (Combo1 = "ssn") Then
        Set Text1.DataSourc e = adoRecordset
        Text1.DataField = "name"

        Set Text2.DataSourc e = adoRecordset
        Text2.DataField = "age"

        Set Text3.DataSourc e = adoRecordset
        Text3.DataField = "dept"


        End If

        End Sub



        if i use form load for combo box it gives ambigous error....i want to add command button also plz giv ur suggestion plz

        Comment

        • debasisdas
          Recognized Expert Expert
          • Dec 2006
          • 8119

          #5
          Originally posted by chans
          adoRecordset.Op en "select name from employee", db.Connectionst ring


          If (Combo1 = "ssn") Then
          Set Text1.DataSourc e = adoRecordset
          Text1.DataField = "name"

          Set Text2.DataSourc e = adoRecordset
          Text2.DataField = "age"

          Set Text3.DataSourc e = adoRecordset
          Text3.DataField = "dept"

          End If
          End Sub
          In the recorset open ,you are selecting only the name from the table.
          then how your DataField is age and dept for text2 and text3 respectively.

          Comment

          • chans
            New Member
            • Oct 2007
            • 8

            #6
            Originally posted by debasisdas
            In the recorset open ,you are selecting only the name from the table.
            then how your DataField is age and dept for text2 and text3 respectively.
            i hav to print all these from from database how to do that?

            Comment

            • chans
              New Member
              • Oct 2007
              • 8

              #7
              Originally posted by chans
              i hav to print all these from from database how to do that?
              when i click on command button on giving ssn it has to retrive all info from employee table

              Comment

              • chans
                New Member
                • Oct 2007
                • 8

                #8
                Originally posted by chans
                when i click on command button on giving ssn it has to retrive all info from employee table
                adoRecordset.Op en "select name from employee", db.Connectionst ring
                adoRecordset.Op en "select age from employee", db.Connectionst ring
                adoRecordset.Op en "select dept from employee", db.Connectionst ring

                If (Combo1 = "ssn") Then
                Set Text1.DataSourc e = adoRecordset
                Text1.DataField = "name"

                Set Text2.DataSourc e = adoRecordset
                Text2.DataField = "age"

                Set Text3.DataSourc e = adoRecordset
                Text3.DataField = "dept"

                End If

                is this ok now sir

                Comment

                • jrtox
                  New Member
                  • Sep 2007
                  • 89

                  #9
                  Originally posted by chans
                  when i click on command button on giving ssn it has to retrive all info from employee table

                  Hello,
                  http://www.thescripts. com/forum/thread718154.ht ml
                  go to this and download my attachment, maybe it could help for your lesson.
                  Study the program.

                  its simple.

                  Regards
                  Phils Ervin

                  Comment

                  Working...