Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Grid not Displaying Correctly 1

Status
Not open for further replies.

hotcoals

Technical User
Jul 12, 2006
7
AU
Hi, I am new to vb.net and am having trouble displaying data in a datagrid. I can get the data in there but when it is displayed it shows a '+' symbol. When I click on that it displays 'Data' and then finally the correct data displys. Any help would be greatly appreciated. Thanks.

Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\CobInvoice\Invoice_be.mdb"
Dim myConnection As OleDbConnection = New OleDbConnection
myConnection.ConnectionString = connString

' Set Where Clause
Dim JobNo As Double
JobNo = txtJobNo.Text

' create a data adapter
Dim da As OleDbDataAdapter = New OleDbDataAdapter("SELECT Data.SortNo, Data.JobNo, Data.Date, Data.Start1, Data.Finish1, Data.JobType, Data.Description, Data.Price, Data.Qty, Data.TotalHrs, Data.SubTot FROM(Data)WHERE Data.JobNo= " & JobNo & " ORDER BY Data.SortNo, Data.Date;", myConnection)

' create a new dataset
Dim ds As DataSet = New DataSet

' fill dataset
da.Fill(ds, "Data")

' write dataset contents to an xml file by calling WriteXml method
' Attach DataSet to DataGrid
DataGrid1.DataSource = ds.DefaultViewManager
 
Replace this:
DataGrid1.DataSource = ds.DefaultViewManager

With this:
DataGrid1.DataSource = ds.Tables(0)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top