Query Tools

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vaniKanabathy
    New Member
    • Mar 2008
    • 52

    Query Tools

    Hi...im doing a query tools using vb6 that runs a query in access, How can i do so....im confused...plz guide me....
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    You just need to frame the query properly and execute that using ADO objects.

    Comment

    • vaniKanabathy
      New Member
      • Mar 2008
      • 52

      #3
      Im not understand..plz zzzzz guide..i'll thank 4 u

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Do you know how to execute a query in VB ?

        Comment

        • vaniKanabathy
          New Member
          • Mar 2008
          • 52

          #5
          I had do the query n it was success . Thank u.Now i face difficulities in trim character from a coloumn like 101-001 to 101001. It can do by run a query in access directly but in vb6 i cant...

          UPDATE Alternator
          SET EversparkNo1 = REPLACE(Everspa rkNo1, '-', '')

          this 1 i do in access query directly

          Comment

          • jamesd0142
            Contributor
            • Sep 2007
            • 471

            #6
            Originally posted by vaniKanabathy
            I had do the query n it was success . Thank u.Now i face difficulities in trim character from a coloumn like 101-001 to 101001. It can do by run a query in access directly but in vb6 i cant...

            UPDATE Alternator
            SET EversparkNo1 = REPLACE(Everspa rkNo1, '-', '')

            this 1 i do in access query directly

            You can run this query through vb also, you ned to execute a non query...

            Comment

            • vaniKanabathy
              New Member
              • Mar 2008
              • 52

              #7
              what is non query? Plzzzzz give me some examples...urge nt..thanks

              Comment

              • debasisdas
                Recognized Expert Expert
                • Dec 2006
                • 8119

                #8
                Originally posted by jamesd0142
                You can run this query through vb also, you ned to execute a non query...
                What is a non query in vb 6.0 ???

                Comment

                • vaniKanabathy
                  New Member
                  • Mar 2008
                  • 52

                  #9
                  Do anyone can help me in solve this problem. I need to update my column using query.

                  Comment

                  • jamesd0142
                    Contributor
                    • Sep 2007
                    • 471

                    #10
                    Originally posted by debasisdas
                    What is a non query in vb 6.0 ???
                    Does vb6 not have something simular to this debasisdas?, I use vb2005 and code such as:

                    [code=vb]
                    imports system.data.ole db

                    Dim oConn As New System.Data.Ole Db.OleDbConnect ion(StrConn)
                    oConn.Close()
                    Dim con As New System.Data.Ole Db.OleDbCommand
                    con.Connection = oConn
                    con.CommandType = CommandType.Tex t
                    con.CommandText = "Insert Statement"
                    oConn.Open()
                    con.ExecuteNonQ uery()
                    [/code]

                    Surely you can do something like this in vb6, right...?

                    Comment

                    • debasisdas
                      Recognized Expert Expert
                      • Dec 2006
                      • 8119

                      #11
                      There is nothing like non query in VB 6.0.

                      If you do not know the answer in the version that is clearly mentioned by the OP in the question, no need to post what you think is correct in higher version.

                      No need to post .NET replies to VB 6.0 questions.

                      Limit those to .NET forums only.

                      Comment

                      • vaniKanabathy
                        New Member
                        • Mar 2008
                        • 52

                        #12
                        Mine is vb6 platform. Plz do help me in correct query to update my field. Plsssssssss i still finding 4 the answer......

                        Comment

                        • debasisdas
                          Recognized Expert Expert
                          • Dec 2006
                          • 8119

                          #13
                          try to use like this

                          [code=vb]
                          con.BeginTrans 'con is the ADODB connection object
                          con.Execute "your sql query here"
                          con.CommitTrans
                          [/code]

                          Comment

                          • vaniKanabathy
                            New Member
                            • Mar 2008
                            • 52

                            #14
                            Type mismatch error occur.Pls help me edit my coding down here.I need it urgently. Thanks in advance.....plz zzzzzzzz help me.


                            db_file = App.Path
                            If Right$(db_file, 1) <> "\" Then db_file = db_file & "\"
                            db_file = db_file & "Everspark2.mdb "

                            ' Open a connection.
                            Set conn = New ADODB.Connectio n
                            conn.Connection String = _
                            "Provider=Micro soft.Jet.OLEDB. 4.0;" & _
                            "Data Source=" & db_file & ";" & _
                            "Persist Security Info=False"
                            conn.Open

                            conn.BeginTrans
                            conn.Execute "UPDATE Alternator SET EversparkNo1 = REPLACE(Everspa rkNo1, " - ", "")"
                            conn.CommitTran s

                            Comment

                            • vaniKanabathy
                              New Member
                              • Mar 2008
                              • 52

                              #15
                              undefine function 'REPLACE' in expression error also occur.

                              Comment

                              Working...