using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; public partial class rp_stockinyard : System.Web.UI.Page { SqlConnection conn = new SqlConnection("server=70.86.107.2;database=AZ;uid=aztecexim;pwd=Az*nEw9"); SqlDataReader dr; SqlDataReader dr1; DataSet ds; protected void Page_Load(object sender, EventArgs e) { conn.Open(); SqlCommand cmd = new SqlCommand("AcSubYard", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@compid", SqlDbType.Int).Value = 3; dr = cmd.ExecuteReader(); while (dr.Read()) { Response.Write(dr[0].ToString()); /* SqlCommand cmd1 = new SqlCommand("stockinyard", conn); cmd1.Parameters.Add("@subaccountid", SqlDbType.Int).Value = dr[0].ToString(); cmd1.Parameters.Add("@productId", SqlDbType.Int).Value = dr[2].ToString(); cmd1.Parameters.Add("@transactiondate", SqlDbType.DateTime).Value = DateTime.Today;*/ } dr.Close(); dr.Dispose(); conn.Close(); } protected void Button1_Click(object sender, EventArgs e) { conn.Open(); SqlCommand cmd1 = new SqlCommand("stockinyard", conn); cmd1.CommandType = CommandType.StoredProcedure; cmd1.Parameters.Add("@subaccountid", SqlDbType.Int).Value = 14035; cmd1.Parameters.Add("@productId", SqlDbType.Int).Value = 8; cmd1.Parameters.Add("@transactiondate", SqlDbType.DateTime).Value = "05april09"; dr1 = cmd1.ExecuteReader(); while (dr1.Read()) { GridView1.DataSource = dr1; GridView1.DataBind(); } } }