c# - 'System.Data.SqlClient.SqlException' How to fix? Visual Studio 2015 -


i'm trying put form variables database, however, i'm still new @ these things , i'm trying random copy pasted code internet learn. thing giving me problems

@using webmatrix.data; @using webmatrix.webdata; @using system.data.sqlclient;   @{     viewbag.title = "recruta";  }  @{       var nome = "";     var email = "";     var tel = "";     var adress = "";     var gender = "";      nome = request.form["nome"];     email = request.form["email"];     tel = request.form["tel"];     adress = request.form["adress"];     gender = request.form["gender"];      var db = database.open("usuarios");     var insertcommand = "insert usuarios (nome, email, tel, adress, gender) values(@0, @1, @2, @3, @4)";     db.execute(insertcommand, nome, email, tel, adress, gender);     response.redirect("~/usuarios");         } 

this information given vs:

an exception of type 'system.data.sqlclient.sqlexception' occurred in system.data.dll not handled in user code  additional information: database 'c:\users\softinsa\documents\visual studio 2015\projects\best_prototype_01\best_prototype_01\app_data\usuarios.mdf' cannot opened because version 851. server supports version 706 , earlier. downgrade path not supported.  cannot attach file 'c:\users\softinsa\documents\visual studio 2015\projects\best_prototype_01\best_prototype_01\app_data\usuarios.mdf' database 'c:\users\softinsa\documents\visual studio 2015\projects\best_prototype_01\best_prototype_01\app_data\usuarios.mdf'. 

and error lies apparently:

  db.execute(insertcommand, nome, email, tel, adress, gender); 

i apologize if i'm posting dumb question, said, i'm still fresh in asp.net , it's endevours.

i appreciate reading , can help.

edit: tried using solutions on the database cannot opened because version 782. server supports version 706 , earlier. downgrade path not supported , none of them worked me, i'm using vs community edition 2015, default connections (localdb)\mssqllocaldb isn't issue here.

first, never ever code business logic inside asp.net mvc views.

second, exception quite clear:

the database '...' cannot opened because version 851. server supports version 706 , earlier. downgrade path not supported.

you don't have right version of sql server running on system. trying open newer database file format version have installed. either install correct version of sql server, or downgrade database file format.

this might related use of visual studio 2015 update 2.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -