{"id":2317,"date":"2012-11-05T17:06:30","date_gmt":"2012-11-05T21:06:30","guid":{"rendered":"http:\/\/www.iowawebnet.com\/ein\/?p=2317"},"modified":"2012-11-05T17:06:30","modified_gmt":"2012-11-05T21:06:30","slug":"array-using-array-vb-net-to-update-multiple-records","status":"publish","type":"post","link":"https:\/\/www.iowawebnet.com\/ein\/2012\/11\/array-using-array-vb-net-to-update-multiple-records\/","title":{"rendered":"Array &#8211; using array (vb.net) to update multiple records"},"content":{"rendered":"<pre>\r\n<code> \r\n'Dim RecIDRE As String = Request.Form(\"reId\")\r\nIf Not RecID = 0 Then\r\nTry\r\n'define sql conn\r\nDim connString As String\r\nconnString = ConfigurationManager.ConnectionStrings(\"MySQLConnectionString1\").ToString\r\nDim conn As New SqlConnection(connString)\r\nDim cmd As New SqlCommand()\r\n\r\nconn.ConnectionString = connString\r\nconn.Open()\r\n\r\nDim printArray As Array = RecID.Split(\",\")\r\nDim i As Integer\r\n\r\n For i = 0 To printArray.Length - 1\r\n  count = count + 1\r\n  Dim AdUpdate As String = _\r\n                      \"UPDATE real_estate _\r\n                      \"SET ad_printed = 'yes' _\r\n                      \"WHERE rid = \" & printArray(i)\r\n  cmd.Connection = conn\r\n  cmd.CommandText = AdUpdate\r\n  cmd.ExecuteNonQuery()\r\n\r\n  Next\r\n  conn.Close()\r\n  conn.Dispose()\r\n\r\n  Catch ex As Exception\r\n    Label1.Text = \"<b>Real Estate Print Error:<\/b> \" & ex.Message.ToString()\r\n    Label1.Attributes.Add(\"style\", \"color: red; fonth-weight: bold;\")\r\n  End Try\r\n     Label2.Text = count & \" ads printed!\"\r\n     Label2.Attributes.Add(\"style\", \"color: green; font-size: 12px;\")\r\n   Else\r\n     Label2.Text = count & \" ads printed!\"\r\n     Label2.Attributes.Add(\"style\", \"color: blue; font-size: 12px;\")\r\n   End If\r\n\r\n<\/code>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&#8216;Dim RecIDRE As String = Request.Form(&#8220;reId&#8221;) If Not RecID = 0 Then Try &#8216;define sql conn Dim connString As String connString = ConfigurationManager.ConnectionStrings(&#8220;MySQLConnectionString1&#8221;).ToString Dim conn As New SqlConnection(connString) Dim cmd As New SqlCommand() conn.ConnectionString = connString conn.Open() Dim printArray As Array = RecID.Split(&#8220;,&#8221;) Dim i As Integer For i = 0 To printArray.Length &#8211; 1 [&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,17,16,67,84],"tags":[120,19,146,21],"class_list":["post-2317","post","type-post","status-publish","format-standard","hentry","category-net-4-0","category-applications","category-net","category-sql","category-vs2010","tag-array","tag-asp-net","tag-sql","tag-visual-studio"],"_links":{"self":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/2317"}],"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=2317"}],"version-history":[{"count":15,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/2317\/revisions"}],"predecessor-version":[{"id":2333,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/2317\/revisions\/2333"}],"wp:attachment":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/media?parent=2317"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/categories?post=2317"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/tags?post=2317"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}