Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Meet and Greet (http://www.go4expert.com/community/meet-and-greet/)
-   -   C# DataGrid in Web App (http://www.go4expert.com/community/c-sharp-datagrid-web-app-t27297/)

C#newbie 6Dec2011 20:00

C# DataGrid in Web App
 
Does anyone know the issue with this code. I am trying to to display a datagrid from a stored procedure on a button click in the WebApp using C#. I have used this code developing a form and it worked perfect but won't translate to the WebApp . My connections are are set up correctly.

cs is my connection
da is my DataAdapter
ds is my Dataset
MessageBox is declared in a previous class and works correctly.

The stored procedure executes correctly because I have checked my tables in the database that update on the button click. I just want to display the results on my WebApp.

Any suggestions?

Code:


protected void Button2_Click1(object sender, EventArgs e)
        {
            da.SelectCommand = new SqlCommand("execute spTEST", cs);
           

            cs.Open();
            da.Fill(ds);
            dg.DataSource = ds.Tables[0];
              MessageBox("SUCCESS!");
            cs.Close();
         
        }


shabbir 6Dec2011 20:41

Re: C# DataGrid in Web App
 
Duplicate of C# DataGrid Web App. Thread closed.


All times are GMT +5.5. The time now is 13:39.