Skip to main content
se añadieron 1602 caracteres en el cuerpo; etiquetas editadas
Origen Enlace
    function tryme() { 

 var modelx = new Object();
   var myFilefile = $('#fileinput').prop('files'"files");[0];

        $.ajax({
 modelx           type: "POST",
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            url: '@Url.fAction("CreateRequest", ="Home")',
 myFile;           data: "{'File':'" + file + "'}",
            success: function (response) {
                alert(modelx.f"at least Ajax looks fine");
            },
            Error: function (textMsg) {

                alert("something got wrong");
            }
        });
 }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
 <input type="file" id="fileinput"   />
<input type="submit"  onclick="tryme()" value="click" />

</body>
</html>
   
    public JsonResult  CreateRequest(FileInfo format )
    {

        string cs = "Data Source=DMX87025;Initial Catalog=DB_PCC;Integrated Security=True";
        string sql = "INSERT INTO [DB_PCC].[dbo].[Testsoru]" +
            "([Format])" +
            "VALUES" +
            "(@Format)";

        

        using (SqlConnection con= new SqlConnection(cs) ) {
            SqlCommand cmd = new SqlCommand(sql,con);
            
            cmd.Parameters.Add("@Format", SqlDbType.VarChar).Value = format;

            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        }

       
        return Json(new { success = true, message = "Success Baby Doll :* ;)"D" }, JsonRequestBehavior.AllowGet);


        // End CreateRequest
    }
 function tryme(){
 var modelx = new Object();
 var myFile = $('#fileinput').prop('files');
 
 modelx.f = myFile;
 
 alert(modelx.f);
 }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
 <input type="file" id="fileinput"   />
<input type="submit"  onclick="tryme()" value="click" />

</body>
</html>
   
    public JsonResult  CreateRequest(FileInfo format )
    {

        string cs = "Data Source=DMX87025;Initial Catalog=DB_PCC;Integrated Security=True";
        string sql = "INSERT INTO [DB_PCC].[dbo].[Testsoru]" +
            "([Format])" +
            "VALUES" +
            "(@Format)";

        

        using (SqlConnection con= new SqlConnection(cs) ) {
            SqlCommand cmd = new SqlCommand(sql,con);
            
            cmd.Parameters.Add("@Format", SqlDbType.VarChar).Value = format;

            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        }

       
        return Json(new { success = true, message = "Success Baby Doll :* ;)" }, JsonRequestBehavior.AllowGet);


        // End CreateRequest
    }
    function tryme() { 

        var file = $('#fileinput').prop("files")[0];

        $.ajax({
            type: "POST",
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            url: '@Url.Action("CreateRequest", "Home")',
            data: "{'File':'" + file + "'}",
            success: function (response) {
                alert("at least Ajax looks fine");
            },
            Error: function (textMsg) {

                alert("something got wrong");
            }
        });
 }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
 <input type="file" id="fileinput"   />
<input type="submit"  onclick="tryme()" value="click" />

</body>
</html>
   
    public JsonResult  CreateRequest(FileInfo format )
    {

        string cs = "Data Source=DMX87025;Initial Catalog=DB_PCC;Integrated Security=True";
        string sql = "INSERT INTO [DB_PCC].[dbo].[Testsoru]" +
            "([Format])" +
            "VALUES" +
            "(@Format)";

        

        using (SqlConnection con= new SqlConnection(cs) ) {
            SqlCommand cmd = new SqlCommand(sql,con);
            
            cmd.Parameters.Add("@Format", SqlDbType.VarChar).Value = format;

            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        }

       
        return Json(new { success = true, message = "Success:D" }, JsonRequestBehavior.AllowGet);


        // End CreateRequest
    }
se añadieron 1602 caracteres en el cuerpo; etiquetas editadas
Origen Enlace
   
    public JsonResult  CreateRequest(string Name, int Category,
        int Department, string Wiw, int Scheme,FileInfo format )
    {

        string cs = "Data Source=DMX87025;Initial Catalog=DB_PCC;Integrated Security=True";
        string sql = "INSERT INTO [DB_PCC].[dbo].[Testsoru]" +
            "([Name],[Wiw] ,[Deparment],[Catergory],[Scheme],[Format])" +
            "VALUES" +
            "";"(@Format)";

        

        using (SqlConnection con= new SqlConnection(cs) ) {
            SqlCommand cmd = new SqlCommand(sql,con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = Name;
            cmd.Parameters.Add("@Wiw", SqlDbType.VarChar).Value = Wiw;
            cmd.Parameters.Add("@Dep", SqlDbType.VarChar).Value = Department;
            cmd.Parameters.Add("@Cat", SqlDbType.VarChar).Value = Category;
            cmd.Parameters.Add("@Sche", SqlDbType.VarChar).Value = Scheme;
            cmd.Parameters.Add("@Format", SqlDbType.VarChar).Value = format;

            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        }

       
        return Json(new { success = true, message = "Success Baby Doll :* ;)" }, JsonRequestBehavior.AllowGet);


        // End CreateRequest
    }
   
    public JsonResult  CreateRequest(string Name, int Category,
        int Department, string Wiw, int Scheme,FileInfo format )
    {

        string cs = "Data Source=DMX87025;Initial Catalog=DB_PCC;Integrated Security=True";
        string sql = "INSERT INTO [DB_PCC].[dbo].[Testsoru]" +
            "([Name],[Wiw] ,[Deparment],[Catergory],[Scheme],[Format])" +
            "VALUES" +
            "";

        

        using (SqlConnection con= new SqlConnection(cs) ) {
            SqlCommand cmd = new SqlCommand(sql,con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = Name;
            cmd.Parameters.Add("@Wiw", SqlDbType.VarChar).Value = Wiw;
            cmd.Parameters.Add("@Dep", SqlDbType.VarChar).Value = Department;
            cmd.Parameters.Add("@Cat", SqlDbType.VarChar).Value = Category;
            cmd.Parameters.Add("@Sche", SqlDbType.VarChar).Value = Scheme;
            cmd.Parameters.Add("@Format", SqlDbType.VarChar).Value = format;

            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        }

       
        return Json(new { success = true, message = "Success Baby Doll :* ;)" }, JsonRequestBehavior.AllowGet);


        // End CreateRequest
    }
   
    public JsonResult  CreateRequest(FileInfo format )
    {

        string cs = "Data Source=DMX87025;Initial Catalog=DB_PCC;Integrated Security=True";
        string sql = "INSERT INTO [DB_PCC].[dbo].[Testsoru]" +
            "([Format])" +
            "VALUES" +
            "(@Format)";

        

        using (SqlConnection con= new SqlConnection(cs) ) {
            SqlCommand cmd = new SqlCommand(sql,con);
            
            cmd.Parameters.Add("@Format", SqlDbType.VarChar).Value = format;

            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        }

       
        return Json(new { success = true, message = "Success Baby Doll :* ;)" }, JsonRequestBehavior.AllowGet);


        // End CreateRequest
    }
se añadieron 1602 caracteres en el cuerpo; etiquetas editadas
Origen Enlace

   
    public JsonResult  CreateRequest(string Name, int Category,
        int Department, string Wiw, int Scheme,FileInfo format )
    {

        string cs = "Data Source=DMX87025;Initial Catalog=DB_PCC;Integrated Security=True";
        string sql = "INSERT INTO [DB_PCC].[dbo].[Testsoru]" +
            "([Name],[Wiw] ,[Deparment],[Catergory],[Scheme],[Format])" +
            "VALUES" +
            "";

        

        using (SqlConnection con= new SqlConnection(cs) ) {
            SqlCommand cmd = new SqlCommand(sql,con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = Name;
            cmd.Parameters.Add("@Wiw", SqlDbType.VarChar).Value = Wiw;
            cmd.Parameters.Add("@Dep", SqlDbType.VarChar).Value = Department;
            cmd.Parameters.Add("@Cat", SqlDbType.VarChar).Value = Category;
            cmd.Parameters.Add("@Sche", SqlDbType.VarChar).Value = Scheme;
            cmd.Parameters.Add("@Format", SqlDbType.VarChar).Value = format;

            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        }

       
        return Json(new { success = true, message = "Success Baby Doll :* ;)" }, JsonRequestBehavior.AllowGet);


        // End CreateRequest
    }

   
    public JsonResult  CreateRequest(string Name, int Category,
        int Department, string Wiw, int Scheme,FileInfo format )
    {

        string cs = "Data Source=DMX87025;Initial Catalog=DB_PCC;Integrated Security=True";
        string sql = "INSERT INTO [DB_PCC].[dbo].[Testsoru]" +
            "([Name],[Wiw] ,[Deparment],[Catergory],[Scheme],[Format])" +
            "VALUES" +
            "";

        

        using (SqlConnection con= new SqlConnection(cs) ) {
            SqlCommand cmd = new SqlCommand(sql,con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = Name;
            cmd.Parameters.Add("@Wiw", SqlDbType.VarChar).Value = Wiw;
            cmd.Parameters.Add("@Dep", SqlDbType.VarChar).Value = Department;
            cmd.Parameters.Add("@Cat", SqlDbType.VarChar).Value = Category;
            cmd.Parameters.Add("@Sche", SqlDbType.VarChar).Value = Scheme;
            cmd.Parameters.Add("@Format", SqlDbType.VarChar).Value = format;

            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        }

       
        return Json(new { success = true, message = "Success Baby Doll :* ;)" }, JsonRequestBehavior.AllowGet);


        // End CreateRequest
    }

se eliminaron 17 caracteres en el cuerpo
Origen Enlace
Loading
se añadieron 15 caracteres en el cuerpo
Origen Enlace
Loading
Origen Enlace
Loading