Jump to content

Insert Into Database From Textbox, How ?


madsovenielsen

Recommended Posts

Hey all.im having a textbox, button and a access database. how do i insert data from the textbox into the access db ?i know the SQL, but i dont know how to parse the input from the textbox to the access db.(im using VB.NET and VS Web developer 2008)/mads

Link to comment
Share on other sites

  • 1 month later...

Hi madsovenielsen, If you want to insert data to access db ,I think you can use ADO.NET (import System.Data.OleDb). Some code as follows:

	  Imports System.Data.OleDbModule Module1	Sub Main()		Dim value as String		value = TextBox1.Text 		Dim con As OleDbConnection = New OleDbConnection		Dim cmd As OleDbCommand = New OleDbCommand		con.ConnectionString = ""  'setting connectionString	  		cmd.CommandText = ""	  'setting sql insert statement with value		cmd.Connection = con		con.Open()		cmd.ExecuteNonQuery()		cmd.Dispose()		con.Close()		con.Dispose()	End SubEnd Module

If you still have any doubt and concern about this issue, please let me know. :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...