Insert records and search the records inserted

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ecstasy4real
    New Member
    • Oct 2007
    • 5

    Insert records and search the records inserted

    Hi Compliments of the day,
    I'm a new bie in vb and trying to write a class that'll insert & search a field but wen i run the program it says this: COMPILE ERROR: Sub or Function not defined.

    Pls can someone assist me on how to go about it?

    Thanks
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    How do you expect us to help you without knowing anything about your code and what exactly you are trying to do and how you are trying to connect to which database.

    Comment

    • ecstasy4real
      New Member
      • Oct 2007
      • 5

      #3
      Insert records and search the records inserted

      Hi Compliments of the day,
      I'm a new bie in vb and trying to write a class that'll insert & search a field but wen i run the program it says this: COMPILE ERROR: Sub or Function not defined.
      [code=vb]
      Private Sub cmdLoad_Click()

      OpenDialog.Canc elError = True
      On Error GoTo ErrHandler


      OpenDialog.Dial ogTitle = "Open File"
      OpenDialog.Filt er = "Text Files (*.txt)|*.txt"
      OpenDialog.Filt erIndex = 1
      OpenDialog.Show Open
      strFileName = OpenDialog.File Name
      'OpenDialog.Fla gs = cdlOFNFileMustE xist + cdlOFNHideReadO nly
      Dim Called, Calling, Start, Stp, Duration, Incom, OutCom As String


      Dim Stream As TextStream
      Dim StrA As String
      Dim RecA As String
      Dim Record As String
      Dim Rec As String
      Dim i As Integer
      Dim j As Integer

      'Try
      Rec = ReadAll
      For j = 0 To i - 1

      'Record = StrA(j)
      RecA = Split(",")
      Dim iLen As Integer
      RecA = Length
      Dim K As Integer
      If j = i Then Exit For


      Called = RecA
      Calling = RecA
      Start = RecA

      Stp = RecA
      Duration = RecA
      Incom = RecA
      OutCom = RecA

      InsertRecord Into(Called, Calling, Start, Stp, Duration, Incom, OutCom)

      Next
      OpenDialog.Canc elError = True
      On Error GoTo ErrHandler

      MsgBox("File Loaded Successfully", vbOKOnly, "File Upload") = vbOK


      End Sub


      Private Function InsertRecord(Ca led As String, Calling As String, Start As String, EndTime As String, Duration As String, Inco As String, OutCo As String)
      sSQL = "Insert into " & cbocity.Text & cboTraffic.Text & "Values('" & Caled & "','" & Calling & "','" & Start & "','" & _
      EndTime & "','" & Duration & "','" & Inco & "','" & OutCo & "')"

      End Function[/code]

      Pls can someone assist me on how to go about it?

      Thanks
      Last edited by debasisdas; Nov 2 '07, 11:52 AM. Reason: Formatted using code tags.

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Both the threads are merged for better management of the forum.

        Comment

        • debasisdas
          Recognized Expert Expert
          • Dec 2006
          • 8119

          #5
          Are you trying to insert data into a database ?

          Comment

          • ecstasy4real
            New Member
            • Oct 2007
            • 5

            #6
            Yes I'm trying to insert it into a database

            Thank you

            Comment

            • debasisdas
              Recognized Expert Expert
              • Dec 2006
              • 8119

              #7
              Originally posted by ecstasy4real
              Yes I'm trying to insert it into a database

              Thank you
              1.Where is the conection string .
              2.What is the output type of the function.
              3.Why using a function where you don't actually need to return a value., which can be done in a procedure
              4.Your SQL statment is wrong.
              5.Why using INTO after the function name to call it .
              6.Calling a function without any variable. It is not a procedure.

              Take care of the above mentioned issues.

              Comment

              Working...