Ado Connection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lee123
    Contributor
    • Feb 2007
    • 556

    Ado Connection

    Hi there my question has pictures and all and the story is i have done this code before and it worked in my last project but i have made a different one a couple of days ago and the code i used is not working so if one of you moderators could look at this and tell me why i would appreciate it. so if you could go to my web page and look at it that would be cool

    here

    lee123
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Hello lee123!

    You should keep good copies of your projects... Can you post the code here instead? I worry when I have to go to another site...

    Hppe you find what you're looking for:-)

    Dököll

    Comment

    • lee123
      Contributor
      • Feb 2007
      • 556

      #3
      yea i just wanted to show you what i mean because everytime i try to explain it doesn't work out the way i wanted to any way here is the code:

      Private Sub DataList1_Click ()
      Dim strSQL As String
      strSQL = "SELECT * FROM TblChildsInfo WHERE childsID =" & "'" & DataList1.Bound Text & "'"
      Adodc2.RecordSo urce = strSQL
      Adodc2.Refresh
      End Sub

      Comment

      • rpicilli
        New Member
        • Aug 2008
        • 77

        #4
        Hi there.

        Is your childsID an integer? If the answer is yes you should remove the ' from your query and convert your DataList1.Bound Text to integer.

        If this is not the case, please tell me what kind of error message are you having.

        Hope this help you

        Rpicilli

        Comment

        • lee123
          Contributor
          • Feb 2007
          • 556

          #5
          well i have posted the code and pictures on my web page and it shows you what error i am getting. because that's the only way i could show anybody whats going on. (It's a new web page i haven't even got anything on it yet but the problem i am having with this project)

          lee123

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            Lee ,

            what do you expect that piece of code to do ?
            what is that doing now ?

            Comment

            • lee123
              Contributor
              • Feb 2007
              • 556

              #7
              well i have a datalist box that is filled with names and when i click on a name i want to display Information. in a datagrid by child id but when i click on the name in the datalist it gives me an error, thats why i wanted someone to look at the pictures on the web page because it explains it all...

              lee123

              Comment

              • rpicilli
                New Member
                • Aug 2008
                • 77

                #8
                Hi Lee,

                Could you please debug your program, stop on the line just after the strSQL = ...

                See what is in strSQL. Is the Datalist1.Bound Text a string? or a object? You could try to add the .ToString at the BoundText and see what happen.

                Rpicilli

                Comment

                • lee123
                  Contributor
                  • Feb 2007
                  • 556

                  #9
                  do you mean ToString datagrid1.bound text if not explain because i'm not good with SQL Still learning As I Go

                  lee123

                  Comment

                  • rpicilli
                    New Member
                    • Aug 2008
                    • 77

                    #10
                    No, datgrid1.boudte xt.tostring

                    Try this. But before, try to debug and see what is inside the variable strSQL. If possible cut and paste the content to this forum.

                    Rpicilli

                    Comment

                    • QVeen72
                      Recognized Expert Top Contributor
                      • Oct 2006
                      • 1445

                      #11
                      Hi,

                      What Item is Selected in The DataList1...?
                      I Guess, you are getting Error because, Your Child ID's, have
                      Special Characters in them like single/double quote or * or % or square bracket..
                      For Single Quote, Replace with double single quote.. and your query will work

                      Regards
                      Veena

                      Comment

                      • rpicilli
                        New Member
                        • Aug 2008
                        • 77

                        #12
                        Originally posted by rpicilli
                        No, datgrid1.boudte xt.tostring

                        Try this. But before, try to debug and see what is inside the variable strSQL. If possible cut and paste the content to this forum.

                        Rpicilli
                        Another issue that may be occur is if the datagrid1.bound text was more then one word you should put inside brackets [ my multiple word ]. As I saw that you are using string as your ID may be the case.

                        Comment

                        Working...