Skip to content

Stored procedure

CREATE PROCEDURE sp_update
(
@id bigint ,
@name varchar(50) ,
@pass varchar(50)
)
AS
BEGIN
UPDATE wDbTest SET User_Name = @name , User_Password = @pass WHERE User_ID = @id

END

—————————————

CREATE PROCEDURE sp_insert
(
@name varchar(50) ,
@pass varchar(50)
)
AS
BEGIN
INSERT INTO wDBTest
VALUES ( @name , @pass )

END

Advertisements

sql Connection

private SqlConnection conn = new SqlConnection();
private SqlCommand comm = new SqlCommand();
private SqlDataAdapter adp = new SqlDataAdapter();
DataTable dt = new DataTable();

protected void Page_Load(object sender, EventArgs e)
{
conn = new SqlConnection(“Data Source=WAQAS-PC;Initial Catalog=waqasDbTest;Integrated Security=True”);
loadData();
}

private void loadData()
{
dt.Clear();
string sqlQuery = string.Empty;
sqlQuery = “select User_ID AS ID , User_Name as Name , User_Password as Password from wDbTest Order by USer_id ASC”;
conn.Open();
adp = new SqlDataAdapter(sqlQuery, conn);
adp.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
conn.Close();       }

protected void selectStoredProcedure(string spName, Hashtable param, DataTable tblName)
{
dt.Clear();
conn.Open();
comm.Parameters.Clear();
comm.Connection = conn;
comm.CommandText = spName;
comm.CommandType = CommandType.StoredProcedure;
foreach (string para in param.Keys)
{
comm.Parameters.AddWithValue(para, param[para]);
}
adp.SelectCommand = (comm);
adp.Fill(tblName);
conn.Close();   }

 

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
Panel1.Visible = true;
Label4.Text = “”;
txtID.Text = GridView1.SelectedRow.Cells[1].Text.ToString();  }

how to keep leaving date always forward than joining date?

////////////////  date checking  criteria for joining and leaving date
///////////////  leaving date is not less than joining date

        private void Join_Date_Picker_ValueChanged(object sender, EventArgs e)
        {
            Leave_Date_Picker.MinDate = Join_Date_Picker.Value;
        }
// by wikisolutions