Bug in Vb.net 2005 'Arguments are of wrong type, are out of acceptable range, or are

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gforgourav
    New Member
    • Nov 2008
    • 3

    Bug in Vb.net 2005 'Arguments are of wrong type, are out of acceptable range, or are

    'Arguments are of wrong type, are out of acceptable range, or are in conflict with one another'
    this error occurs ...
    i m using vb.net 2005 with sql server 2000 backend
    i had a project in vb 6.0 with MS access
    i hav converted it to vb.net 2005 and hav made all necessary changes in code
    now as the project was in vb 6.0 it has adodb recordset for fetching data from table
    now whn i m using sql server connection string i get this error..
    my code is as below,...
    .------------------------------------------------------------
    Public consc As SqlConnection
    .------------------------conection string--------------------------
    consc.Connectio nString = "Data Source=<servern ame>;Initial Catalog=HR;Inte grated Security=True"
    ------------------------code------------------------------------
    Dim ssql as string="select * from employee_master "

    lrsTemp = New ADODB.Recordset
    If lrsTemp.State = 1 Then lrsTemp.Close()
    lrsTemp.Open(ss ql, consc)
    ------------------------code------------------------------------
    i get error on the last line .....i.e.. lrsTemp.Open(ss ql, consc)
    i m getting mad... plz help..
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Instead of using a ADODB.Recordset (which is quite out dated) consider updating your code to use the tools that .NET provides you with to connect to the database and fetch the information.

    Check out this quick reference on how to use a database in your program.

    -Frinny

    Comment

    • gforgourav
      New Member
      • Nov 2008
      • 3

      #3
      thanks for ur views ..but i hav a whole project with about 30 forms and lots of such ADODB.recordset s used .. and its not feasible to change the code on all locations..
      so plz if possible suggest any other solution

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Originally posted by gforgourav
        thanks for ur views ..but i hav a whole project with about 30 forms and lots of such ADODB.recordset s used .. and its not feasible to change the code on all locations..
        so plz if possible suggest any other solution
        I've only briefly worked with ADODB record sets in .NET....
        But try changing your:
        Public consc As SqlConnection

        To be:
        Public consc As ADODB.Connectio n


        I think you're using the wrong connection object.

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #5
          Originally posted by gforgourav
          thanks for ur views ..but i hav a whole project with about 30 forms and lots of such ADODB.recordset s used .. and its not feasible to change the code on all locations..
          so plz if possible suggest any other solution
          Is it not the point of upgrading, to DO just that, UPGRADE?

          Comment

          • gforgourav
            New Member
            • Nov 2008
            • 3

            #6
            Originally posted by Frinavale
            I've only briefly worked with ADODB record sets in .NET....
            But try changing your:
            Public consc As SqlConnection

            To be:
            Public consc As ADODB.Connectio n


            I think you're using the wrong connection object.
            ....
            it was this previously..
            Public consc As ADODB.Connectio n

            i want sql connection so i did change it to this..
            Public consc As SqlConnection

            Comment

            • Plater
              Recognized Expert Expert
              • Apr 2007
              • 7872

              #7
              Originally posted by gforgourav
              ....
              it was this previously..
              Public consc As ADODB.Connectio n

              i want sql connection so i did change it to this..
              Public consc As SqlConnection
              Right, but you want to use ADO recordsets instead of regular .NET objects.
              I think you need to use "like with like", if you want ado recordsets you need to use the ado connection object, if you want to use the SqlConnection object, you'll need to use the SqlCommand, SqlDataAdapter, etc objects.

              Upgrading is never an easy process

              Comment

              Working...