android - Error during Update operation on SQL Server 2012 using ADO.NET -


i'm trying send 2 values android asp.net web api server in order update sql server database table using these 2 values via ado.net.the problem i'm having error , couldn't fix please me , thank's in advance! :) p.s: i'm pretty sure communication android/server works fine because have transmitted data server android here asp.net code:

[httppost]     [actionname("addbox")]     public void addbox(dbproductcompany produit)     {          sqlconnection myconnection = new sqlconnection();         //myconnection.connectionstring = @"server=.\sqlserver2008r2;database=dbcompany;user id=sa;password=tpg@1234;";         myconnection.connectionstring = @"data source=pcheds;database=dbcompany;user id=sa;password=hedi;";         //sqlcommand sqlcmd = new sqlcommand("insert tblemployee (employeeid,name,managerid) values (@employeeid,@name,@managerid)", myconnection);         sqlcommand sqlcmd = new sqlcommand();         sqlcmd.commandtype = commandtype.text;         sqlcmd.commandtext = "update dbproductcompany set login = @login serial = @serial";         sqlcmd.connection = myconnection;         // sqlcmd.parameters.addwithvalue("@sensortype", produit.sensortype);         //sqlcmd.parameters.addwithvalue("@qrcode", produit.qrcode);         sqlcmd.parameters.addwithvalue("@serial", produit.serial);         //sqlcmd.parameters.addwithvalue("@datecreated", produit.datecreated);         sqlcmd.parameters.addwithvalue("@login", produit.login);            myconnection.open();         int rowinserted = sqlcmd.executenonquery();         myconnection.close();     } 

and here error: parameterized query '(@serial nvarchar(4000),@login nvarchar(9)) update dbproductcompany' expects parameter '@serial' not supplied.

here android client side:(just understand i'm sending

class requesttask extends asynctask<string, string, string>{      // url ===> 192.168.134.1:57888/api/employees/gettemperaturebyserial?sensorserial=     @override     protected string doinbackground(string... uri) {         string state = null;         httpclient httpclient = new defaulthttpclient();          sharedpreferences sharedpreferences = getsharedpreferences                   (login.pref_name, context.mode_private);                    string serial = sharedpreferences.getstring(login.pref_serial, "");                   string login = sharedpreferences.getstring(login.pref_username, "");         try {             httppost request = new httppost(uri[0]);             stringentity params =new stringentity("{\"serial\":18eeae9f-7d7f-4538-a2e0-ebe225c798aa,\"login\":\""+login+"\"}");             request.addheader("content-type", "application/json");             request.addheader("accept","application/json");             request.setentity(params);             httpresponse response = httpclient.execute(request);             if(response.getstatusline().getstatuscode()!=204){                 state = "done";             }             else{                 state = "undone";             }              // handle response here...         }catch (exception ex) {             // handle exception here         } {             httpclient.getconnectionmanager().shutdown();         }          return state;     } 


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -