combo box to sql server

  • Thread starter Thread starter sm85
  • Start date Start date
S

sm85

Guest
which part should i be placing the code to connect? Is 2019 syntax different? It doesn't seem to work how i currently have it. Thanks


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace combo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
Dim connection As New SqlConnection("Data Source = DE - IDENTIFIEDDB; Initial Catalog = DE_IDENTIFIED; Integrated Security = True")

Dim command As New SqlCommand("select distinct provider_name from de_identified_claims", connection)

Dim adapter As New SqlDataAdapter(command)

Dim table As New DataTable()

adapter.Fill(table)

ComboBox1.DataSource = table

ComboBox1.DisplayMember = "provider_name"
ComboBox1.ValueMember = "provider_name"
}
}
}

Continue reading...
 
Back
Top