ok this is code:
private void GetDocumentInfo(int pageIndex)
{
using (SqlConnection conn = General.GetConnection())
{
using (SqlCommand cmd = General.GetCommand("NewOrder_Info", conn))
{
int data1 = Convert.ToInt32(Request.QueryString["PeygiriCode"].ToString());
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@PageIndex", pageIndex);
cmd.Parameters.AddWithValue("@PageSize", PageSize);
cmd.Parameters.AddWithValue("@PeygiriCode", data1);
cmd.Parameters.Add("@RecordCount", SqlDbType.Int, 4);
cmd.Parameters["@RecordCount"].Direction = ParameterDirection.Output;
conn.Open();
using (SqlDataAdapter da = new SqlDataAdapter(cmd))
{
DataTable dt = new DataTable();
da.Fill(dt);
if (dt["OrderType"].ToString().ToLower() == "buy")
{
Imagbaygani.Visible = false;
Imgsend.Visible = true;
}
else if (dt["OrderType"].ToString().ToLower() == "link")
{
Imagbaygani.Visible = true;
Imgsend.Visible = false;
}
else
{
if (dt["OrderType"].ToString().ToLower() == "Link" && dt["OrderType"].ToString().ToLower() == "buy")
{
Imagbaygani.Visible = false;
Imgsend.Visible = true;
}
}
gvOrders.DataSource =dt;
gvOrders.DataBind();
}
this error happen:
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0021: Cannot apply indexing with [] to an expression of type 'DataTable'
Source Error:
|
Line 323: DataTable dt = new DataTable();
Line 324: da.Fill(dt);
Line 325: if (dt["OrderType"].ToString().ToLower() == "buy")
Line 326: {
Line 327: Imagbaygani.Visible = false;
|