1 Replies - 10859 Views - Last Post: 04 June 2008 - 12:58 AM Rate Topic: -----

#1 haidan_dan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 29-May 08

display data from SQL server database on the combo box

Posted 03 June 2008 - 09:36 PM

What if i want to display data from SQL server database on the combo box?
i have a problem, it don't display anything. Plz help me..
This is my code
Dim MyConnObj As New ADODB.Connection 'ADODB Connection Object
Dim myRecSet As New ADODB.Recordset 'Recordset Object
Dim sqlStr As String ' String variable to store sql command

MyConnObj.Open _
"Provider = sqloledb;" & _
"Data Source="";" & _
"Initial Catalog=tebrauteguh;" & _
"User ID=sa;" & _
"Password=sa;"

sqlStr = "select * from tblMLeave "

myRecSet.Open sqlStr, MyConnObj, adOpenKeyset

MsgBox "Total Number of records = " & myRecSet.RecordCount

'Dim i As Integer 'variable to keep count
'i = 1

'Print "#"; Tab; "LCode"; Tab; "LName";
'Print ""
With myRecSet

While Not myRecSet.EOF ' Loop until endd fo file is reached

ReaApp.Items.Add (tblMLeave.Item("LName"))
.MoveNext
Wend
End With

MyConnObj.Close


Is This A Good Question/Topic? 0
  • +

Replies To: display data from SQL server database on the combo box

#2 haidan_dan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 29-May 08

Re: display data from SQL server database on the combo box

Posted 04 June 2008 - 12:58 AM

yes i solved it...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1