here is my aspx code:
DATE:
ORDER ID:
TOTAL:
SIGNATURE:
here is .cs code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using iTextSharp.text;
using System.IO;
using iTextSharp.text.html.simpleparser;
using iTextSharp.text.pdf;
using System.Configuration;
namespace yummyproject
{
public partial class myorder : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["mycon"].ToString());
string sid;
string orderid;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Username"] != null)
{
sid = Session["Username"].ToString();
string sql = "SELECT orderid,tdate,total from order1 where sid='" + sid + "' and deliverystatus='notyet'";
SqlDataAdapter da = new SqlDataAdapter(sql, con);
DataTable dt = new DataTable();
da.Fill(dt);
DataList1.DataSource = dt;
DataList1.DataBind();
string qry = "SELECT orderid,tdate,total from order1 where sid='" + sid + "' and deliverystatus='notyet'";
SqlCommand cmd = new SqlCommand(qry, con);
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
orderid = rdr["orderid"].ToString();
}
}
else
{
Response.Write("nothing");
}
}
protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
GridView GridView1 = (GridView)e.Item.FindControl("GridView1");
BindGrid(GridView1, DataList1.DataKeys[e.Item.ItemIndex].ToString());
}
private void BindGrid(GridView GridView, string CusState)
{
string sql ="SELECT * from orderdetail where orderid='" + orderid + "'";
SqlDataAdapter da = new SqlDataAdapter(sql, con);
DataTable dt = new DataTable();
da.Fill(dt);
GridView.DataSource = dt;
GridView.DataBind();
}
}
}
im getting an error
Rajneesh ChaubeyPosted Feb 17, 2018, 11:50 PM