| | |
Empty gridview
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2008
Posts: 5
Reputation:
Solved Threads: 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
Thanks
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
ASP.NET Syntax (Toggle Plain Text)
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
•
•
Join Date: May 2008
Posts: 5
Reputation:
Solved Threads: 0
this method instanciates the dataset
just forgot to put it in the message
so the dataset works ok
asp.net Syntax (Toggle Plain Text)
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
Last edited by peter_budo; Nov 28th, 2008 at 1:08 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
![]() |
Similar Threads
- Gridview display for an empty dataset (ASP.NET)
- ASP.NET GridView.EmptyDataText (ASP.NET)
- Can't get values from Cells in a GridView (C#)
- GridView TemplateField empty cells (ASP.NET)
- Bind Gridview to List collection (ASP.NET)
- Hide Button when DataView is empty (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: How to Search record from the Sql Server Database
- Next Thread: HTTP POST
Views: 1466 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 activexcontrol advice ajax alltypeofvideos anathor application asp asp.net bc30451 bottomasp.net browser button c# c#gridviewcolumn checkbox child click commonfunctions compatible confirmationcodegeneration connection content courier css database datagridview datagridviewcheckbox datalist deadlock development dgv dropdown dropdownlist edit expose feedback flash form formatdecimal forms formview google grid gridview homeedition hosting iframe iis index javascript jquery list login microsoft migration mono mssql multistepregistration numerical object objects panelmasterpagebuttoncontrols problem project ratings rotatepage save schoolproject search security serializesmo.table session silverlight smartcard software sql sqlserver2005 suse textbox tracking typeof unauthorized update validation vb vb.net video view virtualdirectory vista visual-studio visualstudio web webarchitecture webdevelopemnt webservice xml youareanotmemberofthedebuggerusers





