datagrid with typed dataset returns nulls

P

Patrick Sullivan

Hi all, I odered a book on VB.Net (ADO Net core reference) but haven't
recieved it yet. And I have found lots of info on datagrids and have used
them lots before. But now using a typed dataset, I cannot get a view table
in the typed dataset to load into the grid. No errors, just no records.
"Applications" is the typed dataset, and it contains one view named
"vwApplications" that works in SQL server, and I can get it to work using
regular untyped datasets in ADO.Net. What do I need to do in typed datasets
to use it? BTW, it just displays a row of nulls, and it should have data.
There's no null data in the tables or view.

' create instance of the typed dataset

tds = New Applications

' command object to pull data for datasets

Dim cmd As New SqlCommand("SELECT * FROM vwApplications", con)

' Use the sqldataadapter to fill datasets

Dim da As SqlDataAdapter = New SqlDataAdapter

' Select command for Typed Dataset

da.SelectCommand = cmd

' Fill Dataset

da.Fill(tds)

dgApps.SetDataBinding(tds, "vwApplications")

con.Close()

-- TIA

Patrick Sullivan, AA-BA, BA-IT
 
P

Patrick Sullivan

Thanks, Cor, I will check out the urls in a minute. But I want to display
stringA, stringB, stringC, stringD in the grid from related tables, in one
row, not with the !~@!@# +- child row controls. All the main table has is a
few data fields, the rest are foreign keys. That is why I am using a view.

SELECT TOP 1000 dbo.Positions.posName AS [Position],
dbo.Companies.compName AS Company, dbo.Applications.app Date AS [Date],
dbo.Applications.appNotes AS Notes,
dbo.Applications.appID AS ID, dbo.Companies.compID, dbo.Positions.posID
FROM dbo.Companies INNER JOIN
dbo.Applications ON dbo.Companies.compID =
dbo.Applications.appCompany INNER JOIN
dbo.Positions ON dbo.Applications.appPosition =
dbo.Positions.posID
ORDER BY ID

I was wanting to use a typed dataset as well, since I have found that using
untyped might work for a while, but when you modify something, add features,
etc, you tend to get more errors, often with the data types, that's why I
wanna use typed datasets to begin with.
Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top