{"id":42,"date":"2007-07-13T23:53:14","date_gmt":"2007-07-13T23:53:14","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?page_id=42"},"modified":"2008-01-18T16:28:54","modified_gmt":"2008-01-18T16:28:54","slug":"function-updaterow","status":"publish","type":"page","link":"https:\/\/www.wapshere.com\/missmiis\/code-snippets\/function-updaterow","title":{"rendered":"NWHomeDir_CSExtension.vb: Function updateRow"},"content":{"rendered":"<p>This function updates a row in a SQL table. There is probably a way to do it all with one query, but when I wrote it\u00c2\u00a0I was pretty new to SQL, and because it worked I didn&#8217;t change it. \u00c2\u00a0<\/p>\n<p><font size=\"1\" color=\"#0000ff\">Private<\/font><font size=\"1\"> <\/font><font size=\"1\" color=\"#0000ff\">Function<\/font><font size=\"1\"> updateRow(<\/font><font size=\"1\" color=\"#0000ff\">ByVal<\/font><font size=\"1\"> path <\/font><font size=\"1\" color=\"#0000ff\">As<\/font><font size=\"1\"> <\/font><font size=\"1\" color=\"#0000ff\">String<\/font><font size=\"1\">, <\/font><font size=\"1\" color=\"#0000ff\">ByVal<\/font><font size=\"1\"> stringDN <\/font><font size=\"1\" color=\"#0000ff\">As<\/font><font size=\"1\"> <\/font><font size=\"1\" color=\"#0000ff\">String<\/font><font size=\"1\">, <\/font><font size=\"1\" color=\"#0000ff\">ByVal<\/font><font size=\"1\"> Server <\/font><font size=\"1\" color=\"#0000ff\">As<\/font><font size=\"1\"> <\/font><font size=\"1\" color=\"#0000ff\">String<\/font><font size=\"1\">, <\/font><font size=\"1\" color=\"#0000ff\">ByVal<\/font><font size=\"1\"> Volume <\/font><font size=\"1\" color=\"#0000ff\">As<\/font><font size=\"1\"> <\/font><font size=\"1\" color=\"#0000ff\">String<\/font><font size=\"1\">, <\/font><font size=\"1\" color=\"#0000ff\">ByVal<\/font><font size=\"1\"> Folder <\/font><font size=\"1\" color=\"#0000ff\">As<\/font><font size=\"1\"> <\/font><font size=\"1\" color=\"#0000ff\">String<\/font><font size=\"1\">, <\/font><font size=\"1\" color=\"#0000ff\">ByVal<\/font><font size=\"1\"> Status <\/font><font size=\"1\" color=\"#0000ff\">As<\/font><font size=\"1\"> <\/font><font size=\"1\" color=\"#0000ff\">String<\/font><font size=\"1\">) <\/font><font size=\"1\" color=\"#0000ff\">As<\/font><font size=\"1\"> <\/font><font size=\"1\" color=\"#0000ff\">Integer<\/font><\/p>\n<p><font size=\"1\"><font size=\"1\" color=\"#0000ff\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Dim<\/font><font size=\"1\"> modSQL <\/font><font size=\"1\" color=\"#0000ff\">As<\/font><font size=\"1\"> <\/font><font size=\"1\" color=\"#0000ff\">String<\/font><\/font><br \/>\n<font size=\"1\"><font color=\"#0000ff\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Dim<\/font> sqlModCommand <font color=\"#0000ff\">As<\/font> SqlCommand<\/font><\/p>\n<p><font size=\"1\"><font color=\"#0000ff\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 If<\/font> stringDN = &#8220;NULL&#8221; <font color=\"#0000ff\">Then<\/font> <\/font><br \/>\n<font size=\"1\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 modSQL = &#8220;UPDATE &#8221; &amp; MIISSync_DB_TABLE_NAME &amp; &#8221; SET stringDN = NULL where path='&#8221; &amp; path &amp; &#8220;&#8216;&#8221;<\/font><br \/>\n<font size=\"1\"><font color=\"#0000ff\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Else<\/font><\/font><br \/>\n<font size=\"1\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 modSQL = &#8220;UPDATE &#8221; &amp; MIISSync_DB_TABLE_NAME &amp; &#8221; SET stringDN ='&#8221; &amp; stringDN &amp; &#8220;&#8216; where path='&#8221; &amp; path &amp; &#8220;&#8216;&#8221;<\/font><br \/>\n<font size=\"1\"><font color=\"#0000ff\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 End<\/font> <font color=\"#0000ff\">If<\/font><\/font><br \/>\n<font size=\"1\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 sqlModCommand = <font color=\"#0000ff\">New<\/font> SqlCommand(modSQL, sqlExportConnection)<\/font><br \/>\n<font size=\"1\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 sqlModCommand.ExecuteNonQuery()<\/font><\/p>\n<p><font size=\"1\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 modSQL = &#8220;UPDATE &#8221; &amp; MIISSync_DB_TABLE_NAME &amp; &#8221; SET Server ='&#8221; &amp; Server &amp; &#8220;&#8216; where path='&#8221; &amp; path &amp; &#8220;&#8216;&#8221;<\/font><br \/>\n<font size=\"1\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 sqlModCommand = <font color=\"#0000ff\">New<\/font> SqlCommand(modSQL, sqlExportConnection)<\/font><br \/>\n<font size=\"1\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 sqlModCommand.ExecuteNonQuery()<\/font><\/p>\n<p><font size=\"1\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 modSQL = &#8220;UPDATE &#8221; &amp; MIISSync_DB_TABLE_NAME &amp; &#8221; SET Volume ='&#8221; &amp; Volume &amp; &#8220;&#8216; where path='&#8221; &amp; path &amp; &#8220;&#8216;&#8221;<\/font><br \/>\n<font size=\"1\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 sqlModCommand = <font color=\"#0000ff\">New<\/font> SqlCommand(modSQL, sqlExportConnection)<\/font><br \/>\n<font size=\"1\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 sqlModCommand.ExecuteNonQuery()<\/font><\/p>\n<p><font size=\"1\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 modSQL = &#8220;UPDATE &#8221; &amp; MIISSync_DB_TABLE_NAME &amp; &#8221; SET Folder ='&#8221; &amp; Folder &amp; &#8220;&#8216; where path='&#8221; &amp; path &amp; &#8220;&#8216;&#8221;<\/font><br \/>\n<font size=\"1\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 sqlModCommand = <font color=\"#0000ff\">New<\/font> SqlCommand(modSQL, sqlExportConnection)<\/font><br \/>\n<font size=\"1\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 sqlModCommand.ExecuteNonQuery()<\/font><\/p>\n<p><font size=\"1\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 modSQL = &#8220;UPDATE &#8221; &amp; MIISSync_DB_TABLE_NAME &amp; &#8221; SET Status ='&#8221; &amp; Status &amp; &#8220;&#8216; where path='&#8221; &amp; path &amp; &#8220;&#8216;&#8221;<\/font><br \/>\n<font size=\"1\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 sqlModCommand = <font color=\"#0000ff\">New<\/font> SqlCommand(modSQL, sqlExportConnection)<\/font><br \/>\n<font size=\"1\"><font color=\"#0000ff\">\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Return<\/font> sqlModCommand.ExecuteNonQuery()<\/font><\/p>\n<p><font size=\"1\"><font color=\"#0000ff\">End<\/font> <font color=\"#0000ff\">Function<\/font><\/font><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This function updates a row in a SQL table. There is probably a way to do it all with one query, but when I wrote it\u00c2\u00a0I was pretty new to SQL, and because it worked I didn&#8217;t change it. \u00c2\u00a0 Private Function updateRow(ByVal path As String, ByVal stringDN As String, ByVal Server As String, ByVal&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":30,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-42","page","type-page","status-publish","hentry"],"jetpack_shortlink":"https:\/\/wp.me\/Pkp1o-G","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":0,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages\/42\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/pages\/30"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}