VB.NET WCF - Error Using my function -


i have function information on sql server table. know function correct , returning suposed (i used msgbox check it). problem when try use function displays error:

enter image description here

my wcf function:

    public function getclinfo(byval cl_id integer) implements sqloperator.getclinfo     dim clinfo(7) string     try         sqlcon.connectionstring = sqlconstring         sqlcon.open()          sqlcmd = new sqlcommand("select * dbo.cl id=" & cl_id & ";", sqlcon)         sqldatareader = sqlcmd.executereader()          while sqldatareader.read             clinfo(0) = sqldatareader("id")             clinfo(1) = sqldatareader("name")             clinfo(2) = sqldatareader("address")             clinfo(3) = sqldatareader("contact")         end while          return clinfo     catch ex exception         msgbox("error: " & environment.newline & ex.tostring)         clinfo(0) = "false"         return clinfo             sqlcon.close()         sqlcon.dispose()     end try      return clinfo end function 

in picture can see aswell how i'm trying use function.

can kindly tell me doing wrong?

your problem calling function return string array , program doesn't catch itself. @matt wilko point out use option strict on. second if have more 1 client logic fails.

for integer = 1 allcl dim cl(7) string cl = service.getclinfo(i) next 

above code reset every each time, plus when leave loop loosing access cl.

ugly fix multidimensional array.

now should specify return type

public function getclinfo(byval cl_id integer) string() implements sqloperator.getclinfo 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -