Jump to content

insert text box value into combobox selected table


rony_78
 Share

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...