|
-
Jan 12th, 2003, 11:30 PM
#1
Thread Starter
New Member
problem with combobox
using mircosoft visual basic .net on smart application device,plaform is pocket pc..
i tried using ' ComboBox2.Items.Insert(0, "-- Choose --") ' to make it as default,but it jjuz display my 1st record of my database..anyone idea why??
Here's my code..
Dim dsn As String
Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'determine which server and database to use
dsn = "server = 198.0.0.91; uid=sa; pwd=; database=Boxoffice"
Dim myConnection As SqlConnection = New SqlConnection()
myConnection.ConnectionString = dsn
Dim da As SqlDataAdapter = New SqlDataAdapter("Select * from Book", myConnection)
' create a new dataset
Dim ds As DataSet = New DataSet()
' fill dataset
da.Fill(ds, "Book")
' Attach DataSet to ComboBox2
ComboBox2.DataSource = ds.Tables(0)
ComboBox2.DisplayMember = "Date"
ComboBox2.Items.Insert(0, "-- Choose --")
End Sub
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
|