set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[p_UpdateMainQ] @MainQuestionId VARCHAR (50) AS UPDATE MAINQUESTION SET SurveyId=@MainQuestionId WHERE MainQuestion =MainQuestion
public int UpdateMainQuestion(string MainQuestion) { //using (SqlConnection connection = new SqlConnection(connectionInfo)) //{ // connection.Open(); // SqlDataReader myReader = null; // SqlCommand myCommand = new SqlCommand("p_UpdateMainQ", connection); // myCommand.CommandType = CommandType.StoredProcedure; // myCommand.Parameters.Add(new SqlParameter("@MainQuestion", MainQuestion)); // myReader = myCommand.ExecuteReader(); // if (myReader.Read()) // { // //txtMQ.Text = myReader[1].ToString(); // } //} SqlConnection conn = new SqlConnection(connectionInfo); conn.Open(); SqlCommand dCmd = new SqlCommand("p_UpdateMainQ", conn); dCmd.CommandType = CommandType.StoredProcedure; try { //dCmd.Parameters.AddWithValue("@MainQuestionId", MainQuestionId); // dCmd.Parameters.AddWithValue("@SurveyId", 1); dCmd.Parameters.AddWithValue("@MainQuestion", MainQuestion); return dCmd.ExecuteNonQuery(); } catch { throw; } finally { dCmd.Dispose(); conn.Close(); conn.Dispose(); } }
public int UpdateMainQuestion(string MainQuestion) { return MQDAL.UpdateMainQuestion(MainQuestion); }
try { string Ques = lstMainQ.SelectedItem.ToString(); txtMain.Text = Ques; txtMain.Focus(); int Index = lstMainQ.SelectedIndex; lstMainQ.Items.RemoveAt(lstMainQ.SelectedIndex); String MainQuestion = txtMain.Text; MainQuestionBAL MQBAL = new MainQuestionBAL(); int MQ= MQBAL.UpdateMainQuestion(MainQuestion); if (MQ.Equals(1)) { }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)