Results 1 to 11 of 11

Thread: MySQL adding error [Resolved]

  1. #1

    Thread Starter
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Resolved MySQL adding error [Resolved]

    I connect to a remote MySQL database. But sometimes when I go to add a new record, i get this error :

    ERROR : -2147217887

    Multiple-step operation generated errors. Check each status value.
    Any ideas? What I do when I connect to the DB is :

    VB Code:
    1. With Rs
    2.         .AddNew 'adding new record
    3.         .Fields("Username") = sUsername
    4.         .Fields("Password") = sPassword
    5.         .Update 'this updates the recordset etc.
    6.     End With

    Thanks
    Last edited by manavo11; Oct 4th, 2004 at 06:32 AM.


    Has someone helped you? Then you can Rate their helpful post.

  2. #2

    Thread Starter
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171
    OK. This only happens when the length is >6 Even if the datatype of the field is Varchar(20) or even 40. Still problems with over 6. With 6, it works. Any ideas?

    Thanks


    Has someone helped you? Then you can Rate their helpful post.

  3. #3

    Thread Starter
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171
    This seems to be a problem with MySQL 3.x . I tried with MySQL 4.x and I don't have this problem.... Oh well


    Has someone helped you? Then you can Rate their helpful post.

  4. #4

    Thread Starter
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171
    Well, that wasn't it.... I tried with another DB again that was MySQL 4.x and I had the same error again So is this something that just depends on the server providing the database?

    Thanks


    Has someone helped you? Then you can Rate their helpful post.

  5. #5

    Thread Starter
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171
    Bump?


    Has someone helped you? Then you can Rate their helpful post.

  6. #6
    Addicted Member
    Join Date
    Nov 2003
    Posts
    137
    Can you post FULL code. Modify your personal info out tho.
    Live to love, Not to hate

  7. #7
    Addicted Member
    Join Date
    Nov 2003
    Posts
    137
    ok this works using VBMySQLDirect its easy to use. But you must distribute the dll's with the program. Here is the site link:
    Download Page
    Home Page

    Code:
        Dim pCnn As MYSQL_CONNECTION
        Dim pRs As MYSQL_RS
    
        Set pCnn = New MYSQL_CONNECTION
    
        ' User/pass that connect to mysql
        pCnn.OpenConnection "127.0.0.1", "Username", "Password", "atomsoftweb"
    
     Set pRs = New MYSQL_RS
     Dim SQL1 As String
     
     Dim Var As String, Var2 As String, var3 As String
     Var = "theUsername" ' This is the username you want to enter into a new record.
     Var2 = "ThePassword" ' This is the password encryted.
     var3 = Chr(34) & Var & Chr(34) & ", " & Chr(34) & Var2 & Chr(34)
     
     SQL1 = "INSERT into users (username, password) VALUES (" & var3 & ");"
     
     pRs.OpenRs SQL1, pCnn
        
    'Put some error handling here
     pCnn.CloseConnection
     Set pCnn = Nothing
    Live to love, Not to hate

  8. #8
    Addicted Member
    Join Date
    Nov 2003
    Posts
    137
    or if you want try this ok.
    Note: pCnn is the connection to mysql ok
    Code:
        With rs
            .OpenRs "select * from users", pCnn
            .AddNew 'adding new record
            .Fields("Username") = sUsername 
            .Fields("Password") = sPassword 
            .Update 'this updates the recordset etc.
        End With
    Last edited by AtomSoft; Oct 1st, 2004 at 08:48 AM.
    Live to love, Not to hate

  9. #9

    Thread Starter
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171
    Well, it was the connection string It seems I had to use the OPTION=1 to not "Optimize column width". The magic number was 6 because the first username I put was 6 characters long. So after that everything was trying to get optimized (was getting limited) to 6 characters.

    Well, at least that is my theory... Can anyone back it up (or crush it)?



    Has someone helped you? Then you can Rate their helpful post.

  10. #10
    Addicted Member
    Join Date
    Nov 2003
    Posts
    137
    What is your current Connection String ? If you want to be help supply some code. Maybe thats why no one is helping they have yet to see what you got done so far. Even if something is wrong show the code so we can try to help.
    Live to love, Not to hate

  11. #11

    Thread Starter
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171
    Never mind... That was the problem. I tested it and now it works fine Thanks


    Has someone helped you? Then you can Rate their helpful post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width