hi
I want bind gridview so I used belwo code:
using (SqlConnection conn = General.GetConnection())
{
using (SqlCommand _cmd = General.GetCommand("ViewUserInfo", conn))
{
string ipAddress;
ipAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (ipAddress == "" || ipAddress == null)
ipAddress = Request.ServerVariables["REMOTE_ADDR"];
_cmd.Parameters.AddWithValue("@IPAddress", ipAddress);
conn.Open();
SqlDataReader _dr = _cmd.ExecuteReader();
while (_dr.Read())
{
LblMob.Text = _dr["Mobile"].ToString();
LblUsername.Text = _dr["Name"].ToString();
LblEmail.Text = _dr["Email"].ToString();
if (_dr["OrderType"].ToString() == "لینک دانلود")
{
if (_dr.HasRows)
{
GridView1.DataSource = _dr;
GridView1.DataBind();
}
createTemporaryLink();
}
}
}
}
but it doesn't show data from first row of table...
AND SP:
ALTER procedure [dbo].[ViewUserInfo]
@IPAddress VARCHAR(50)
as
begin
select *
from Temp_users
where IPAddress=@IPAddress
end
Best Regards
Neda