Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using a datagrid
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00857342
Message ID:
00858109
Vues:
20
>>Using the Northwind database, I'm trying to display the order records associated with the employee currently being displayed. For the first employee, EmployeeID=1, I should get 123 records.
>>
>>I'm still stuck on something...pardon me for being a newbie to VB... I followed an example from microsoft. The example worked. I tried doing what I saw in their example but I'm still missing something.
>>
>>According to the debugger, my dataset that I've associcated with my datagrid, has 123 records in it. However all I'm seeing in my datagrid are the column headings for the orders table.
>>
>>Any idea what I'm missing?
>>--------------------------------------
>It's hard to tell without seeing your code, but here is a sample of (more or less) what you should have to bind data to a grid:
>
>
>        Dim ConnString As String = "data source=(local);initial catalog=northwind;Integrated Security=SSPI"
>        Dim Connection As New SqlConnection(ConnString)
>        Dim GetData As New SqlCommand
>        GetData.Connection = Connection
>        GetData.CommandText = "select * from Employees"
>        Dim da As New SqlDataAdapter(GetData)
>        Dim ds As New DataSet
>        da.Fill(ds, "Employee")
>        Me.DataGrid1.DataMember = "Employee"
>        Me.DataGrid1.DataSource = ds
>
>-----------------------------------------
Hetcor,
Thanks for the help. It turned out I had part of my code in a subroutine (kinda following the example I had), this resulted in scope issues.
My example is now working.

I do have a follow-up question tho...
In VB.Net during design time, when I place the DataGrid on the form, I don't see any way to tell it how many columns, what field they correspond to, how wide the column should default to, or any formatting information for the columns... (are you familar with Visual FoxPro?)... Am I missing something or is the VB.Net DataGrid that different from the Visual FoxPro DataGrid (which is what I'm used to)?

Thanks,
Rick
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform