|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Datagrid problem 4guysfromrolla tutorial
Here is the code from the tutorial.... may make more since if you can go to
http://aspnet.4guysfromrolla.com/articles/040502-1.aspx <% @Import Namespace="System.Data" %> <% @Import Namespace="System.Data.SqlClient" %> <script language="vb" runat="server"> Sub Page_Load(sender as Object, e as EventArgs) BindData() End Sub Sub BindData() '1. Create a connection Dim myConnection as New SqlConnection( ConfigurationSettings.AppSettings("connectionString")) '2. Create the command object, passing in the SQL string Const strSQL as String = "sp_Popularity" Dim myCommand as New SqlCommand(strSQL, myConnection) 'Set the datagrid's datasource to the datareader and databind myConnection.Open() dgPopularFAQs.DataSource = myCommand.ExecuteReader( CommandBehavior.CloseConnection) dgPopularFAQs.DataBind() End Sub </script> <asp:datagrid id="dgPopularFAQs" runat="server" /> |
|
#2
|
|||
|
|||
|
Hi,
you have not mentioned the problem in the post. The code looks fine. Happy Programming, Vimal |
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > Datagrid problem 4guysfromrolla tutorial |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|