c# - SQL error with update -
I have a problem updating what's wrong?
Compiles the code, but when I click the click button, line -> Cmd.ExecuteNonQuery (); Did not work.
Here the error
Additional information: query with parameter '(@nmo int, @ rezerwoâ ???? INA) updated SETTT.amiejska = @no mo' parameter ' @rezerwo ', which was not provided. Inactivity 1: System.Web.UI.Page SqlConnection cn = new SqlConnection (@ "Data Source = (LocalBible) \ v11.0; Attach debuff filename =
C: \ Users \ DED \ Documents \ Visual Studio 2013 \ Projects \ sV1 \ Stopovisie1 \ Epadata-STV 1.MDF; Integrated Security = True; MultipleActiveRelasticSets = True; Application Name = EntityFramework "); SqlCommand CMD = new SQL Commands (); Secure Zero Page_load (Object Sender, EventAg E) CMD Connection = CN; Protected Zero GridView1 selected Indexed object (object sender, EventArgs e) var g = GridView1.Row selected; String Razrov = Gridview 1.DataK [G.Datitum Index] ["Idoforti"]. Toasting (); Me = Gridview 1. Selected R. Kell [5]. Text; Int nmo = Convert toInt32 (m); Int rezerwo = Convert toInt32 (rezerw); If (Gridview 1. Selected R.Kel [5]. Lesson! = "" And Gridview 1. Selected R.Kel [0]. Lesson! = "") {Cn.Open (); Nmo--; CMD = CN Crete Commands (); Cmd.CommandText = ("Operative Artelle SET oferty.miejsca = @nmo WHERE oferty.idoferty = @rezerwo"); Cmd.Parameters.Add (new SqlParameter ("@ nmo", nmo)); Cmd.Parameters.Add (new SqlParameter ("@Rezerozo" ???, Richero)); String Snmo = Convert. Toaster (NMO); Td.miejsca = snmo; Cmd.ExecuteNonQuery (); cn.Close (); } Db.rezerwacjes.InsertOnSubmit (TC); Db.SubmitChanges (); Constructor of SqlParamter may have interpreted another parameter incorrectly (SqlDbType instead of the actual value)
cmd.Parameters.Add (New SqlParameter ("@ nmo", nmo) instead of
; Cmd.Parameters.Add (new SqlParameter ("@Rezerozo" ???, Richero));
Try
cmd.Parameters.AddWithValue ("@mo", nmo); Cmd.Parameters.AddWithValue ("@Reservavou" ???, Richero);
Another point. Functionality can be stored with the default command type, try adding it to your code:
cmd.CommandType = CommandType.Text;
Comments
Post a Comment