0

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

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by l1985
0

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

0

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

0

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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.