dcsimg
Results 1 to 4 of 4

Thread: Still quite new to c# having problem calling a function in a dll

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2016
    Posts
    70

    Still quite new to c# having problem calling a function in a dll

    I have a dll I created in vb. I referenced it in my c# project and added the Using statement.

    I can get it working up to the point I call the function.

    Here is the subset of the code.

    using ARISQL;

    String SVR = "Servername";
    String DB = "Databasename";
    String SQuery = "SQL Query";
    int result;
    String checkdate;

    ARISQL.ARISQL oSql;

    checkdate = oSql.runQuery(SVR, DB, SQuery, result);

    I am getting and error on the last statement "The best overloaded method match for 'ARISQL.ARISQL.runQuery(ref string, ref string, ref string, ref int' has some invalid arguments."

    Can someone let me know what I am doing incorrect? I am passing 3 strings and an integer.

    Thanks
    Last edited by BSWhipp; Sep 28th, 2018 at 10:23 AM.

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Apr 2016
    Posts
    70

    Re: Still quite new to c# having problem calling a function in a dll

    OK, I have moved to the second error

    I changed the offending line to checkdate = oSql.runQuery(ref SVR, ref DB, ref SQuery, ref result);

    The error now is "Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?)"

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2016
    Posts
    70

    Re: Still quite new to c# having problem calling a function in a dll

    OK, I have moved to the Third error

    I added

    Object res

    I changed the offending line to res = oSql.runQuery(ref SVR, ref DB, ref SQuery, ref result);

    The error now is "Use of unassigned local variable 'oSql'"

    I am down to this last error I would think and I have no idea where to go.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2016
    Posts
    70

    Re: Still quite new to c# having problem calling a function in a dll

    I got it

    Had to change this:
    ARISQL.ARISQL oSql;
    to this:
    ARISQL.ARISQL oSql = new ARISQL.ARISQL();

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width