{"id":2489,"date":"2013-11-21T16:17:09","date_gmt":"2013-11-21T20:17:09","guid":{"rendered":"http:\/\/www.iowawebnet.com\/ein\/?p=2489"},"modified":"2013-11-21T16:17:09","modified_gmt":"2013-11-21T20:17:09","slug":"vb-net-oledbconnection-properties","status":"publish","type":"post","link":"https:\/\/www.iowawebnet.com\/ein\/2013\/11\/vb-net-oledbconnection-properties\/","title":{"rendered":"VB.NET &#8211; OleDbConnection Properties"},"content":{"rendered":"<p>Insert data using OleDbConnection<\/p>\n<pre>\r\nUse ACE.OLEDB for databse connection (insert data)\r\n<code>\r\nPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As \r\nSystem.EventArgs) Handles Button1.Click\r\n\r\nDim con As New OleDbConnection(\"Provider=Microsoft.ACE.OLEDB.12.0;Data\r\n Source=C:\\Projects\\Northwind.accdb;Persist Security Info=False\")\r\nDim CmdStr As String = \"insert into sample _\r\n                        (emp_name,category,city) _\r\n                        values ('\" & TextBox2.Text & \"',_\r\n                        '\" & TextBox3.Text & \"',_\r\n                         '\" & TextBox4.Text & \"')\"\r\n\r\ncon.Open()\r\nDim cmd As OleDbCommand = New OleDbCommand(CmdStr, con)\r\ncmd.ExecuteNonQuery()\r\n\r\ncon.Close()\r\nMsgBox(\"Done\")\r\n\r\nEnd Sub\r\n<\/code>\r\n<\/pre>\n<p>Retrieve data using OleDbConnection <a style=\"display:none;\" id=\"te1621770828\" href=\"javascript:expand('#te1621770828')\">Read more&#8230;<\/a>\n<div class=\"te_div\" id=\"te1621770828\"><script language=\"JavaScript\" type=\"text\/javascript\">expander_hide('#te1621770828');<\/script><\/p>\n<pre>\r\nUse ACE.OLEDB for databse connection (retrieve data)\r\n<code>\r\nPrivate Sub Button2_Click(ByVal sender As System.Object, ByVal e As \r\nSystem.EventArgs) Handles Button2.Click\r\n\r\nDim con As New OleDbConnection(\"Provider=Microsoft.ACE.OLEDB.12.0;Data\r\n Source=C:\\Projects\\Northwind.accdb;Persist Security Info=False\")\r\nDim Query2 As String = \"select * from Sample\"\r\nDim Da As OleDbDataAdapter, Ds As New DataSet, Dtb As New System.Data.DataTable\r\n\r\ncon.Open()\r\nDa = New OleDbDataAdapter(Query2, con)\r\nDa.Fill(Ds)\r\n\r\ncon.Close()\r\n\r\nDtb = Ds.Tables(0)\r\nDataGridView1.DataSource = Dtb\r\n\r\nEnd Sub\r\n\r\n<\/code>\r\n<\/pre>\n<p><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Insert data using OleDbConnection Use ACE.OLEDB for databse connection (insert data) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim con As New OleDbConnection(&#8220;Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Projects\\Northwind.accdb;Persist Security Info=False&#8221;) Dim CmdStr As String = &#8220;insert into sample _ (emp_name,category,city) _ values (&#8216;&#8221; &#038; TextBox2.Text &#038; &#8220;&#8216;,_ &#8216;&#8221; &#038; TextBox3.Text &#038; &#8220;&#8216;,_ &#8216;&#8221; &#038; [&hellip;]<\/p>\n","protected":false},"author":35,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[85,28,17,16,32,67,138],"tags":[],"class_list":["post-2489","post","type-post","status-publish","format-standard","hentry","category-net-4-0","category-access","category-applications","category-net","category-ms-sql","category-sql","category-vs2012"],"_links":{"self":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/2489"}],"collection":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/comments?post=2489"}],"version-history":[{"count":8,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/2489\/revisions"}],"predecessor-version":[{"id":2503,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/2489\/revisions\/2503"}],"wp:attachment":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/media?parent=2489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/categories?post=2489"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/tags?post=2489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}