prem_rajani
Member
Hi guyz,
The steps I followed was :
1) In command prompt I executed the line -
tlbImp E:\sqldmo.dll /out:vbSqlDMO which creates an instance for SQLDMO.
2) Then I add this dll as a reference in my project.
3) In form load I populate a combobox filling it up with server name.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i
Dim mySqlDMO As New vbSqlDMO.ApplicationClass
Dim mynamelist As vbSqlDMO.NameList
mynamelist = mySqlDMO.Application.ListAvailableSQLServers
For i = 0 To mynamelist.Count
Dim str As String = mynamelist.Item(i)
ComboBox1.Items.Add(str)
Next
End Sub
I get some typecast error. After inserting a breakpoint it gets stuck in
mynamelist = mySqlDMO.Application.ListAvailableSQLServers
What mistake am I doing or should it be other way of coding. Anyone can please help me.
The steps I followed was :
1) In command prompt I executed the line -
tlbImp E:\sqldmo.dll /out:vbSqlDMO which creates an instance for SQLDMO.
2) Then I add this dll as a reference in my project.
3) In form load I populate a combobox filling it up with server name.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i
Dim mySqlDMO As New vbSqlDMO.ApplicationClass
Dim mynamelist As vbSqlDMO.NameList
mynamelist = mySqlDMO.Application.ListAvailableSQLServers
For i = 0 To mynamelist.Count
Dim str As String = mynamelist.Item(i)
ComboBox1.Items.Add(str)
Next
End Sub
I get some typecast error. After inserting a breakpoint it gets stuck in
mynamelist = mySqlDMO.Application.ListAvailableSQLServers
What mistake am I doing or should it be other way of coding. Anyone can please help me.