|
-
May 12th, 2009, 04:43 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] sql command help needed
I got this code to get alll the notes loaded
Code:
Private Sub Load_History()
Dim myCnt As Integer
Dim myStr As String
Dim myDataset As New DataSet
Dim i As Integer = 10
Dim e As Integer = -1
myStr = "select owner,names from orders"
Dim sqldaHistory As New SqlDataAdapter(myStr, nwindconn)
sqldaHistory.Fill(myDataset, "orders")
myCnt = myDataset.Tables(0).Rows.Count
Do While i > 0
i = i - 1
e = e + 1
pnltable.RowStyles.Add(New RowStyle(SizeType.Absolute, 100))
Dim lblName As New Label
'lblName.Text = myDataset.Tables(0).Rows(e).Item("owner")
Dim listEvent As New ListBox
listEvent.Size = New Size(100, 20)
listEvent.Items.Add("Update")
Dim lblNote As New Label
lblNote.Text = myDataset.Tables(0).Rows(e).Item("notes")
lblNote.Size = New Size(300, 100)
pnltable.Controls.Add(lblName)
pnltable.Controls.Add(listEvent)
pnltable.Controls.Add(lblNote)
Loop
End Sub
It displays 10 latest notes for me, but I also want it to display the name from the same row as notes.
-
May 12th, 2009, 07:40 AM
#2
Re: sql command help needed
Why wouldn't this work?
Code:
lblName.Text = myDataset.Tables(0).Rows(e).Item("names")
-
May 13th, 2009, 03:14 AM
#3
Thread Starter
Fanatic Member
Re: sql command help needed
it says that the column does not belong to the table "orders" when I know it's there.
I think myStr = "select notes from orders" may not be suitable for multiple columns. it is only good to take one of the columns from the DB (owner or notes). So it does work with one of these but not with both
Thanks
-
May 13th, 2009, 03:24 AM
#4
Hyperactive Member
Re: sql command help needed
hey MrtforCode
u may select as many as columns from the table even from multitables too
just use select * from orders all columns and all records will be returned
* If my post helped you, please Rate it
* If your problem is solved please also mark the thread resolved it is there in right top of page under thread tools
* Why Rating is useful
-
May 13th, 2009, 04:28 AM
#5
Thread Starter
Fanatic Member
Re: sql command help needed
cheers, resolved
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|