Hi thank you for replay my problem is I get the value for to string query and set the value for textbox after edit the text box value and save the data but it not save the current value when I get string query value my store procedure is work working I below mention the my code plz. Help me
public static int AddCourseDetails(string cid,string coursecode,string coursedetatils,string status)
{
int no_of_rows_effected;
string procedure = "Prc_ST_SaveCourse";
using (SqlConnection connection = ConnectionManager.GetGrandHotel_DB_Connection())
{
SqlCommand command = new SqlCommand(procedure, connection);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@C_ID", SqlDbType.Int).Value = cid;
command.Parameters.Add("@Course_Code", SqlDbType.VarChar).Value = coursecode;
command.Parameters.Add("@Course_details",SqlDbType.VarChar).Value = coursedetailsvo.course_details;
command.Parameters.Add("@Status",SqlDbType.TinyInt).Value = coursedetailsvo.status;
no_of_rows_effected = command.ExecuteNonQuery();
}
return no_of_rows_effected;
}
------------------------------------------------------------------------
public partial class Coursedetails : System.Web.UI.Page
{
CourseDetailsDA Mdb = new CourseDetailsDA();
CourseDetailsVO cvo = new CourseDetailsVO();
int cid;
string tmpcode;
protected void Page_Load(object sender, EventArgs e)
{
string courseid;
CourseDetailsVO coursevo = new CourseDetailsVO();
courseid = Request.QueryString["cid"];
if (courseid == null)
{
cid = 0;
}
else
{
cid = int.Parse(courseid);
fillForm();
}
}
protected void CmdSave_Click(object sender, EventArgs e)
{
int no_of_rows_effected;
string strcoursecode = txtCoursecode.Text;
string strcoursedetails = TxtCourseName.Text;
CourseDetailsVO obj = new CourseDetailsVO();
obj.p_id = cid;
obj.course_code = strcoursecode;
obj.course_details = strcoursedetails;
obj.status = 1;
no_of_rows_effected = CourseDetailsDA.AddCourseDetails(obj);
if (no_of_rows_effected > 0)
{
Master.LblSuccessMessageText = "Course Details has been Save Successfully";
txtCoursecode.Text = "";
TxtCourseName.Text = "";
}
}
protected void CmdClear_Click(object sender, EventArgs e)
{
txtCoursecode.Text = "";
TxtCourseName.Text = "";
}
protected void fillForm()
{
DataSet ds = new DataSet();
tmpcode = Request.QueryString["cid"];
ds = cvo.ReturnMasterData("1", tmpcode, "", "");
DataRow dr = ds.Tables[0].Rows[0];
txtCoursecode.Text = dr["Course_Code"].ToString();
TxtCourseName.Text = dr["Course_Details"].ToString();
}
--------------------------------------------------------------------
public class CourseDetailsVO
{
CourseDetailsDA bendb = new CourseDetailsDA();
public CourseDetailsVO()
{
}
public int p_id { get; set; }
public string course_code { get; set; }
public string course_details { get; set; }
public Int16 status { get; set; }
public DataSet ReturnMasterData(string MasterId, string param1, string param2, string param3)
{
CourseDetailsDA MstrDb = new CourseDetailsDA();
DataSet MstrDat = new DataSet();
switch (MasterId)
{
case "1":
long tmpBnkId = long.Parse(param1);
MstrDat = CourseDetailsDA.GetCourseDataByID(tmpBnkId);
break;
default:
MstrDat = new DataSet();
break;
}
return MstrDat;
}
}