Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Sub btnGet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGet.Click
Dim item As ListItem
For Each item In ListBox2.Items
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
Dim strState As String
item = ListBox2.SelectedItem
Dim MySQL As String
** I want to query the db for those items that are in Listbox2 and add them to the datagrid **
MySQL = "Select * from vwContactsAll where Item = " & item.Text & " and tag = 'Memst' and type='m' and active = '1'"
MyConnection = New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
MyCommand = New SqlDataAdapter(MySQL, MyConnection)
DS = New DataSet
MyCommand.Fill(DS, "stuff")
DataGrid1.DataSource = DS.Tables("stuff").DefaultView
DataGrid1.DataBind()
Next
End Sub
Dim item As ListItem
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
Dim sFields as String = ""
For Each item In ListBox2.Items
sField += ListBox2.SelectedItem & ", "
Next
'strip the last ", "
sField = sField.TrimEnd(", ")
Dim MySQL As String = "Select " & sFields & " from vwContactsAll where Item = " & item.Text & " and tag = 'Memst' and type='m' and active = '1'"
MyConnection = New SqlConnection (ConfigurationSettings.AppSettings("connectionString"))
MyCommand = New SqlDataAdapter(MySQL, MyConnection)
DS = New DataSet
MyCommand.Fill(DS, "stuff")
DataGrid1.DataSource = DS.Tables("stuff").DefaultView
DataGrid1.DataBind()
Dim sFields as String = ""
For Each item In ListBox2.SelectedItems
sField += item & ", "
Next
Private Sub btnGet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGet.Click
Dim item As ListItem
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
Dim sFields As String = ""
For Each item In ListBox2.Items
sFields = sFields & ","
Next
'strip the last ", "
sFields = sFields.TrimEnd(", ")
Dim MySQL As String = "Select " & sFields & " from vwContactsAll where tag = 'Memst' and type='m' and active = '1'"
MyConnection = New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
MyCommand = New SqlDataAdapter(MySQL, MyConnection)
DS = New DataSet
MyCommand.Fill(DS, "stuff")
DataGrid1.DataSource = DS.Tables("stuff").DefaultView
DataGrid1.DataBind()
End Sub
Private Sub btnGet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGet.Click
Dim item As ListItem
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
Dim sFields As String = ""
For Each item In ListBox2.Items
[red][b]sFields = sFields & ", "[/b][/red]
Next
'strip the last ", "
sFields = sFields.TrimEnd(", ")
Dim MySQL As String = "Select " & sFields & " from vwContactsAll where tag = 'Memst' and type='m' and active = '1'"
MyConnection = New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
MyCommand = New SqlDataAdapter(MySQL, MyConnection)
DS = New DataSet
MyCommand.Fill(DS, "stuff")
DataGrid1.DataSource = DS.Tables("stuff").DefaultView
DataGrid1.DataBind()
End Sub
For Each item In ListBox2.Items
sFields += item.Value & ", "
Next