Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. Dim cmd As New SqlCommand("Select col_name FROM college ", cn)
  2. If cn.State = ConnectionState.Closed Then cn.Open()
  3. Dim ds As New DataSet
  4. Dim sqda As New SqlDataAdapter(cmd)
  5. sqda.Fill(ds, "college")
  6.  
  7. Dim col As New AutoCompleteStringCollection
  8. Dim i As Integer
  9. For i = 0 To ds.Tables(0).Rows.Count - 1
  10. col.Add(ds.Tables(0).Rows(i)("col_name").ToString())
  11. Next
  12. TextBox1.AutoCompleteSource = AutoCompleteSource.CustomSource
  13. TextBox1.AutoCompleteCustomSource = col
  14. TextBox1.AutoCompleteMode = AutoCompleteMode.Suggest
  15.  
  16. cmd = New SqlCommand("insert into college (col_name) values (N'" & TextBox1.Text.Trim & "')", cn)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement