[Solved] An Update statement in a loop

This can be done with a single update statement. delete from question where id = 2; with new_order as ( select row_number() over (partition by survey_id order by question_no) as new_question_no, question_no as old_question_no, id from question ) update question set question_no = nq.new_question_no from new_order nq where nq.id = question.id and survey_id = 44; … Read more

[Solved] FileUpload Error? [duplicate]

You cannot find a control in the GridView directly when its in the row, you have to find it in the row of the gridview. Use either: GridView1_RowDataBound event if(e.Row.RowType == DataControlRowType.DataRow) { FileUpload fileupload = (FileUpload)e.Row.FindControl(“fileupload1”); } OR DataRow r = (DataRow)sender; FileUpload fileupload = (FileUpload)r.FindControl(“fileupload1”); solved FileUpload Error? [duplicate]

[Solved] How to write Parameterised Query in .NET Framework 1.1

I have solved the problem : I changed the code as : cmd.Parameters.Add(“@EmployeeID”,EmployeeID); cmd.Parameters.Add(“@ReasonOfChange”,ReasonOfChange); And also cmd = new SqlCommand(strQuery,Connection); Previously Connection is missing. Thanks for your valuable inputs. 1 solved How to write Parameterised Query in .NET Framework 1.1

[Solved] Login screen using asp.net and SQL Server

This line of code: string checkuser = “select * from tb_Login where Username=”” + txtUsername.Text + “” and Password='” + txtPassword.Text + “‘ “; Is sending a query to the database and asking: “Give me all the columns from tb_Login whose UserName is the value in the txtUsername box and the Password is in the … Read more

[Solved] Send Javascript Vairable To C# MVC controller [closed]

If I understand what you’re trying to do here is to call an endpoint with plain javascript? This will do the job for you: function callYourController(id, propertyName, value) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { console.log(this.responseText); } }; xhttp.open(“POST”, “www.google.com?id=” + id + … Read more

[Solved] I am try to Pagination using Skip Take in Code Frist Approach But given Error

[HttpPost] [Route(“Paging”)] public async Task <ActionResult<IQueryable<City>>> Paging(int CurrentPage=1) { var abc= await _dropdowncontext.cities.OrderBy(x=>x.CityId).Skip((CurrentPage – 1) * 5).Take(5).ToListAsync(); if (!abc.Any()) return NotFound(); return Ok(abc); } 1 solved I am try to Pagination using Skip Take in Code Frist Approach But given Error

[Solved] Count items in a list – ASP.NET C# [closed]

try this : protected void btnSearch_Click(object sender, EventArgs e) { string searchWord = txtWord.Text; ZaraEntities db = new ZaraEntities(); var results = db.Products.Where(p => p.Name.Contains(searchWord)); rptrSearch.DataSource = results.ToList(); rptrSearch.DataBind(); litResults.Text = “<p>” + “Search results for ” + “‘” + txtWord.Text + “‘” + ” (“+ results.ToList().Count + “) Results found.</p>”; } OR litResults.Text = … Read more