Need help in VB. Please help fast

Discussion in 'Programming' started by supercoolboy09, Feb 28, 2009.

  1. #1
    Hello guys,

    I am making a program in VB as frontend and Sql2000 as Backend.
    Now i have a form to add new employee in the database. There is a button on the form as Add. After filling all the fields in the form when the user clicks on Add it should be added in the Employee table in the database. This is the code that i am using to add the record:

    Private Sub add_Click()
    
    emp.Recordset.AddNew Array("emp_no", "f_name", "l_name", "designation", "emp_image"), Array(Val(Text1), Text2, Text3, Combo1.Text, strpath)
    
    End Sub
    Code (markup):
    Here 'emp' is name of the ADODC component. It is already connected to the database and to the employee table.
    Now when i run it and after entering records this is the error i get:

    Run-time error '-2147217887 (80040e21)':
    Multiple-step operations generated errors. Check each status value.
    Code (markup):
    I am stuck up and cant go ahead with my project.

    Please i request you to help me soon.

    Thanking you.
     
    supercoolboy09, Feb 28, 2009 IP
  2. supercoolboy09

    supercoolboy09 Peon

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Please help me.
    I am really stuck at this form and can't proceed.

    Please
     
    supercoolboy09, Feb 28, 2009 IP
  3. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #3
    what is your connection string?
     
    camjohnson95, Mar 2, 2009 IP
  4. alexpr07

    alexpr07 Active Member

    Messages:
    284
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    73
    #4
    Please provide more info. This error could happen because of incorrect values. What's Text2, Text3? If it's empty could be a reason for an error.

    In any case, please provide full script.
     
    alexpr07, Mar 4, 2009 IP
  5. alexpr07

    alexpr07 Active Member

    Messages:
    284
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    73
    #5
    Also, is the recordset open? Maybe you could use INSERT INTO query instead?
    I know in ASP you can have something like this DatabaseObject.Execute "INSERT INTO table_name SET (field1, field2) values (Text1, Text2)"
     
    alexpr07, Mar 4, 2009 IP