{"id":1409,"date":"2011-08-30T17:14:52","date_gmt":"2011-08-30T21:14:52","guid":{"rendered":"http:\/\/www.iowawebnet.com\/ein\/?p=1409"},"modified":"2011-09-14T09:30:02","modified_gmt":"2011-09-14T13:30:02","slug":"select-count-count-total-of-records","status":"publish","type":"post","link":"https:\/\/www.iowawebnet.com\/ein\/2011\/08\/select-count-count-total-of-records\/","title":{"rendered":"Select Count * (count total of records)"},"content":{"rendered":"<blockquote><p>VB.NET<\/p><\/blockquote>\n<pre>\r\n<code>\r\nProtected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load\r\nIf Not Page.IsPostBack Then\r\n Try\r\n '\/ access db connection - MS Access 2007\/10 \r\n '  driver * you can define your own sql connection\r\n Dim ConnDB As New OleDbConnection(\"Provider=Microsoft.ACE.OLEDB.12.0;\r\n                                   Data Source=\" & Server.MapPath(\"my_db.accdb\"))\r\n\r\n'\/ open connection\r\n    ConnDB.Open()\r\n     Dim cmd As New OleDbCommand(\"select count(*) from table1 WHERE \r\n                                  location = 'My_Location'\", ConnDB)\r\n     Dim count As Integer = CInt(cmd.ExecuteScalar())\r\n\r\n      If count >= 90 Then '\/ if count >= do this\r\n        lblMsg1.Text = \"There is 90 or more records!\"\r\n      Else\r\n        lblMsg1.Text = \"Total number of records is \" & count.ToString()\r\n      End If\r\n\r\n   Catch ex As Exception\r\n     Throw New Exception(ex.Message)\r\n     Finally\r\n   ConnDB.close()\r\n   End Try\r\nEnd If\r\n\r\nEnd Sub\r\n<\/code>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>VB.NET Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then Try &#8216;\/ access db connection &#8211; MS Access 2007\/10 &#8216; driver * you can define your own sql connection Dim ConnDB As New OleDbConnection(&#8220;Provider=Microsoft.ACE.OLEDB.12.0; Data Source=&#8221; &#038; Server.MapPath(&#8220;my_db.accdb&#8221;)) &#8216;\/ open connection ConnDB.Open() Dim cmd As New OleDbCommand(&#8220;select count(*) from table1 [&hellip;]<\/p>\n","protected":false},"author":35,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28,16,32],"tags":[40,61,36],"class_list":["post-1409","post","type-post","status-publish","format-standard","hentry","category-access","category-net","category-ms-sql","tag-count","tag-select","tag-total"],"_links":{"self":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/1409"}],"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=1409"}],"version-history":[{"count":8,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/1409\/revisions"}],"predecessor-version":[{"id":1415,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/1409\/revisions\/1415"}],"wp:attachment":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/media?parent=1409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/categories?post=1409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/tags?post=1409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}