{"id":2310,"date":"2012-10-26T17:52:25","date_gmt":"2012-10-26T21:52:25","guid":{"rendered":"http:\/\/www.iowawebnet.com\/ein\/?p=2310"},"modified":"2012-10-24T17:54:13","modified_gmt":"2012-10-24T21:54:13","slug":"update-counter-in-lookup-table","status":"publish","type":"post","link":"https:\/\/www.iowawebnet.com\/ein\/2012\/10\/update-counter-in-lookup-table\/","title":{"rendered":"Update counter in lookup table"},"content":{"rendered":"<pre>\r\nCode behind\r\n<code>\r\nImports System.Web.UI\r\nImports System.Data.Sql\r\nImports System.Data.SqlClient\r\n\r\nPartial Class _Default\r\n Inherits System.Web.UI.Page\r\n\r\nProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) \r\n                        Handles Me.Load\r\n 'acquire the ad id\r\n  Dim adLookupCS As String = ConfigurationManager.ConnectionStrings +\r\n                       (\"My_ConnectionString1\").ToString\r\n  Dim adLookupConn As New SqlConnection(adLookupCS)\r\n  Dim adLookupCmd As New SqlCommand(\"SELECT * FROM recordLookup;\", adLookupConn)\r\n  Dim adLookupRdr As SqlDataReader\r\n    Try\r\n    adLookupCmd.Connection.Open()\r\n    adLookupRdr = adLookupCmd.ExecuteReader()\r\n    If adLookupRdr.Read() Then\r\n    adNumber.Text = adLookupRdr(0)\r\n       Try\r\n        Dim adLNUpdCon As String = ConfigurationManager.ConnectionStrings +\r\n                           (\"My_ConnectionString1\").ToString\r\n        Dim adLNUpdStr As String = \"UPDATE ss_ad_lookup SET lookupNumber = @lkNumb\"\r\n        Dim count As Integer = adLookupRdr(0) + 1\r\n        Dim SQLConn As New SqlConnection()\r\n        Dim SQLCmd As New SqlCommand()\r\n        SQLConn.ConnectionString = adLNUpdCon\r\n        SQLConn.Open()\r\n\r\n        'define parameters\r\n         SQLCmd.Parameters.AddWithValue(\"@lkNumb\", count)\r\n         SQLCmd.Connection = SQLConn\r\n         SQLCmd.CommandText = adLNUpdStr\r\n         SQLCmd.ExecuteNonQuery()    'execute SQL connection\r\n         SQLConn.Close()\r\n         SQLConn.Dispose()\r\n       Catch ex As Exception\r\n           'ex.Message.ToString()\r\n       End Try\r\n     End If\r\n     Catch ex As Exception\r\n           'ex.Message.ToString()\r\n      End Try\r\n  adLookupCmd.Connection.Close()\r\n  adLookupCmd.Dispose()\r\n\r\n    End Sub\r\nEnd Class\r\n<\/code>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Code behind Imports System.Web.UI Imports System.Data.Sql Imports System.Data.SqlClient Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load &#8216;acquire the ad id Dim adLookupCS As String = ConfigurationManager.ConnectionStrings + (&#8220;My_ConnectionString1&#8221;).ToString Dim adLookupConn As New SqlConnection(adLookupCS) Dim adLookupCmd As New SqlCommand(&#8220;SELECT * FROM recordLookup;&#8221;, adLookupConn) Dim adLookupRdr As SqlDataReader [&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,32,84],"tags":[],"class_list":["post-2310","post","type-post","status-publish","format-standard","hentry","category-net-4-0","category-applications","category-net","category-ms-sql","category-vs2010"],"_links":{"self":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/2310"}],"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=2310"}],"version-history":[{"count":5,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/2310\/revisions"}],"predecessor-version":[{"id":2315,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/2310\/revisions\/2315"}],"wp:attachment":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/media?parent=2310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/categories?post=2310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/tags?post=2310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}