Jump to content
Sign in to follow this  

insert text box value into combobox selected table

Recommended Posts

I am new to vb.net .I would like to know how do i insert text box value into combobox selected table ?i can load tables names in combobox but how do i insert into combobox selected table?Thanks in advance

Private Sub Form1_Load(ByVal sender As Object, _					   ByVal e As EventArgs) Handles MyBase.Load		con.Open()		Me.ComboBox1.DisplayMember = "TABLE_NAME"		Me.ComboBox1.ValueMember = "TABLE_NAME"		Me.ComboBox1.DataSource = Me.con.GetSchema("TABLES", New String() {Nothing, Nothing, Nothing, "TABLE"})		con.Close()	End SubPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click		Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\testdb2.accdb")	  Dim CmdStr As String = "insert into table1 (a,b,c) values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "')"		con.Open()		Dim cmd As OleDbCommand = New OleDbCommand(CmdStr, con)		cmd.ExecuteNonQuery()		con.Close()		MsgBox("Done")	End Sub

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...