Results 1 to 5 of 5
  1. #1
    Join Date
    May 2002
    Posts
    2

    Post Unanswered: Unable to addnew with VB.

    Hi,

    I try to use MySQL with visual basic. I can make a connection, create a table and create some fields in this table. But When I try to add something in it with the command ".AddNew", I receive the next error message : "Multiple-step OLE DB operation generated errors. Chekc each OLE DB status values, if available. No work was done!". I don't know where is the problem. Please help me!!!

    Alain

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Please post your code. Have you tried to pull information from the database ? What type of cursor are you using - client or server ? What is the design of the table - please include name/data type/size/default value ?

  3. #3
    Join Date
    May 2002
    Posts
    2

    Post CODE

    Hi,

    Thanks fror you reply.
    My code is:

    Dim myConn As New ADODB.Connection
    Dim myRS As New Recordset
    Dim MySQL As String
    Dim myrows As Long

    'BParam has to contain the name of user data base ex "alain"
    'On Error Resume Next
    Err = 0

    myConn.Open "DSN=alain"
    MySQL = "SELECT * FROM client" 'define table
    myRS.Source = MySQL

    myRS.CursorLocation = adUseServer

    myRS.Open MySQL, myConn, adOpenDynamic, adLockOptimistic

    lTemp = myRS.MaxRecords

    myRS.Filter = ""
    myRS.Requery
    myRS.MoveLast

    myRS.AddNew

    myRS!nom = szNom
    myRS!adresse = szAdresse
    myRS!cp = szCP
    myRS!client = szClient
    myRS!ville = szVille
    myRS!tel = szTel

    myRS.Update
    'myRS.Save
    myRS.Close


    My table was created manually and all fields are 50chars with default = "". I tried to make connection in client and server mode but I always received the same error message.

    Thanks in advance.

    Alain.

  4. #4
    Join Date
    May 2002
    Posts
    1
    Try using OPTION = 3 in you connection statement. See below.

    thisConn.Open ("DRIVER={MySQL ODBC 3.51 Driver};Server=localhost;DATABASE=Quotes;OPTION=3" )

  5. #5
    Join Date
    Feb 2002
    Posts
    2,232
    Can you supply an equivalent of your DSN as a connection string ?

    Which mdac version are you running ?

Posting Permissions

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