sajjad1365
سه شنبه 14 اردیبهشت 1389, 12:00 عصر
سلام.من براي نمايش اطلاعات بانك در ديتا گريد اين كدها رو نوشتم .خطا نميده ولي نمايش هم نميده.يعني صفحه كاملا لود ميشه ولي فقط گريد نمايش داده نميشه.
****البته همين كدها تو برنامه ساده c# (ويندوز اپلكيشن) به درستي اجرا شد.****
string Conn;
Conn = "Data Source=.;Initial Catalog=forushgah;Integrated Security=True";
SqlConnection Connection = new SqlConnection(Conn);
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand= new SqlCommand();
da.SelectCommand.Connection = new SqlConnection();
da.SelectCommand.Connection.ConnectionString = Conn;
da.SelectCommand.CommandText = "select * from users";
DataSet ds = new DataSet();
Connection.Open();
da.Fill(ds);
DataTable dt = new DataTable();
dt = ds.Tables[0];
GridView1.DataSource = dt;
Connection.Close();
****البته همين كدها تو برنامه ساده c# (ويندوز اپلكيشن) به درستي اجرا شد.****
string Conn;
Conn = "Data Source=.;Initial Catalog=forushgah;Integrated Security=True";
SqlConnection Connection = new SqlConnection(Conn);
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand= new SqlCommand();
da.SelectCommand.Connection = new SqlConnection();
da.SelectCommand.Connection.ConnectionString = Conn;
da.SelectCommand.CommandText = "select * from users";
DataSet ds = new DataSet();
Connection.Open();
da.Fill(ds);
DataTable dt = new DataTable();
dt = ds.Tables[0];
GridView1.DataSource = dt;
Connection.Close();