Hello
I'm making a wabsite with a gridview(so far..)
but,when i try to fill with a dataset ...nothing ,i can't see no data
and my dataset is never empty ,it contains data .I ran some debugs and the dataset reads correctly from the sql server database
here's the code

DataSet ds = cat.GetAll("toto", "toto1");
            GridPontosInteresse.DataSource = ds;
            GridPontosInteresse.DataBind();


        public DataSet GetAll(string user, string pass)
        {

            StatusEnum en = Helper.ValidateUser(user, pass);
            if (en.Equals(StatusEnum.OK))
            {
                //
                SqlConnection conn = new SqlConnection(Helper.CONN);
                return Helper.GetAllFromTable(conn, "Pontos_interesse");
}
 static public DataSet GetAllFromTable(SqlConnection conn, string table ){
 string strsql = "SELECT * FROM [" + table+"];";
SqlDataAdapter da = new SqlDataAdapter(strsql , conn);       SqlCommandBuilder cmdBldr = new SqlCommandBuilder(da); 
  da.Fill(ret,"cc");

Thanks

If i understand correctly, you need to instantiate your dataset

VB code

dim ds as new dataset

C# (Pls. correct the syntax if its wrong)

dataset ds = new dataset

this method instanciates the dataset

static public DataSet GetAllFromTable(SqlConnection conn, string table )
           {
 DataSet ret = new DataSet();
              string strsql = "SELECT * FROM [" + table+"];";
				SqlDataAdapter da = new SqlDataAdapter(strsql , conn);

                SqlCommandBuilder cmdBldr = new SqlCommandBuilder(da); 
               

                 da.Fill(ret,"cc");

                ....
		}

just forgot to put it in the message
so the dataset works ok

found it

i created a new gridview and tried to bind the data to it ,ad it worked so,the problem was in the gridview(maybe some property set to false)

This article has been dead for over six months. Start a new discussion instead.