asp.net mvc - MVC-update takes effect from stored procedure in database side but not from the same sp in c# MVC -
i have following code, run stored procedure after that. in case, grid not updated, if run stored procedure same values in database, grid gets updated.
i no errors in either case. possible connection aborted database?
[httppost] public void update_grid(turbinedvce frm) { npgsqlconnection con = null; datatable ds = new datatable(); string cn = system.configuration.configurationmanager.connectionstrings["lts"].connectionstring; con = new npgsqlconnection(cn); try { var test_publicip = "null"; var test_devicetype = "null"; var test_modelproducer = "null"; var test_description = "null"; var test_username = "null"; var test_password = "null"; var test_phone = "null"; var test_firmwareversion = "null"; if(frm.publicip != null) { test_publicip = "'" + frm.publicip + "'"; } if (frm.devicetype != null) { test_devicetype = "'" + frm.devicetype + "'"; } if (frm.modelproducer != null) { test_modelproducer = "'" + frm.modelproducer + "'"; } if (frm.description != null) { test_description = "'" + frm.description + "'"; } if (frm.username != null) { test_username = "'" + frm.username + "'"; } if (frm.password != null) { test_password = "'" + frm.password + "'"; } if (frm.phone != null) { test_phone = "'" + frm.phone + "'"; } if (frm.firmwareversion != null) { test_firmwareversion = "'" + frm.publicip + "'"; } var sql = @"select zd.zd_add_devices_to_turbine( '" + frm.turbineid+ @"', '" + frm.deviceip + @"', " + test_devicetype + @", " + test_modelproducer + @", " + test_description + @", " + test_username + @" , " + test_password + @" , " + test_phone + @" , " + test_publicip + @", " + test_firmwareversion + @")"; npgsqldataadapter adapt = new npgsqldataadapter(sql, cn); con.close(); con.dispose();
where executenonquery?
wiki
Comments
Post a Comment