<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Software Sleuthing : Database</title><link>http://blogs.msdn.com/joshpoley/archive/tags/Database/default.aspx</link><description>Tags: Database</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Finding Database Connection Strings</title><link>http://blogs.msdn.com/joshpoley/archive/2009/05/07/finding-database-connection-strings.aspx</link><pubDate>Thu, 07 May 2009 19:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9593908</guid><dc:creator>joshpoley</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/joshpoley/comments/9593908.aspx</comments><wfw:commentRss>http://blogs.msdn.com/joshpoley/commentrss.aspx?PostID=9593908</wfw:commentRss><description>&lt;P class=MsoNormal&gt;For a simple tool I was working on I needed to talk to a Microsoft Access database from my program. Now, most of the database work I've done in the past has been against SQL Server, so I needed to dig up the magic voodoo which represents the "connection string" for Access 2007 files. The connection string is used to tell the engine underlying the APIs how to talk to a specific type of database or file (i.e. what driver to use). Unfortunately most of the samples I found in MSDN were for an older version of Access (dealing with the old .mdb files) and not for 2007's .accdb files. &lt;/P&gt;
&lt;P class=MsoNormal&gt;After consulting my good friend Google, I stumbled across the "&lt;A href="http://www.connectionstrings.com/" mce_href="http://www.connectionstrings.com/"&gt;Connection String&lt;/A&gt;" site which gave me exactly what I needed and I figured was useful enough to share.&lt;/P&gt;
&lt;P class=MsoNormal mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9593908" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/joshpoley/archive/tags/Database/default.aspx">Database</category></item><item><title>Writing Strings with OLE (CCommand)</title><link>http://blogs.msdn.com/joshpoley/archive/2008/03/18/writing-strings-with-ole-ccommand.aspx</link><pubDate>Tue, 18 Mar 2008 23:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8322019</guid><dc:creator>joshpoley</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/joshpoley/comments/8322019.aspx</comments><wfw:commentRss>http://blogs.msdn.com/joshpoley/commentrss.aspx?PostID=8322019</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;This last weekend I was writing a COM object for submitting/editing entries into a SQL Server 2005 database we have for collecting project metrics. To do so, I was using the templated &lt;A href="http://msdn2.microsoft.com/en-us/library/2e1ecxey(VS.80).aspx" mce_href="http://msdn2.microsoft.com/en-us/library/2e1ecxey(VS.80).aspx"&gt;OLE DB&lt;/A&gt; functions: &lt;A href="http://msdn2.microsoft.com/en-us/library/yfte190h(VS.80).aspx" mce_href="http://msdn2.microsoft.com/en-us/library/yfte190h(VS.80).aspx"&gt;CCommand&lt;/A&gt;&amp;lt;&lt;A href="http://msdn2.microsoft.com/en-us/library/z828c118(VS.80).aspx" mce_href="http://msdn2.microsoft.com/en-us/library/z828c118(VS.80).aspx"&gt;CDynamicAccessor&lt;/A&gt;&amp;gt;, and things were progressing well until I needed to write a string value into a varchar field. &lt;/P&gt;
&lt;H2 style="MARGIN: 12pt 0in 3pt"&gt;&lt;FONT size=3&gt;The SetValue Problem&lt;/FONT&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;The documentation for CDynamicAccessor's &lt;A href="http://msdn2.microsoft.com/en-us/library/904kd69t(VS.80).aspx" mce_href="http://msdn2.microsoft.com/en-us/library/904kd69t(VS.80).aspx"&gt;SetValue&lt;/A&gt; API was helpful enough to tell me that "special handling" is required when trying to store string data, but is a little vague on the specifics. After some searching around I came across a KB article (&lt;A href="http://support.microsoft.com/kb/201390" mce_href="http://support.microsoft.com/kb/201390"&gt;KB201390&lt;/A&gt;) which goes into a recommended solution which involves the horribly evil practice of blindly copying data into a buffer you don’t own. I am actually very surprised that this is the best they could come up with at the time, as this is a very good way to corrupt memory or quite possibly introduce a security vulnerability.&lt;/P&gt;
&lt;H2 style="MARGIN: 12pt 0in 3pt"&gt;&lt;FONT size=3&gt;The Solution&lt;/FONT&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;After a little more poking around, I ran across the &lt;A href="http://msdn2.microsoft.com/en-us/library/wfc92wyd(VS.80).aspx" mce_href="http://msdn2.microsoft.com/en-us/library/wfc92wyd(VS.80).aspx"&gt;CDynamicStringAccessor&lt;/A&gt;, which has a nice &lt;A href="http://msdn2.microsoft.com/en-us/library/1127yd5w(VS.80).aspx" mce_href="http://msdn2.microsoft.com/en-us/library/1127yd5w(VS.80).aspx"&gt;SetString&lt;/A&gt; method. This let me avoid the evil hack suggested in the KB article, and did so with very little churn to my code. So now I was able to edit the strings in the database, and everything was happy with my testing. At least until the point where it didn't work...&lt;/P&gt;
&lt;H2 style="MARGIN: 12pt 0in 3pt"&gt;&lt;FONT size=3&gt;The NULL Problem&lt;/FONT&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;I have a little test script for trying out my COM object which consists of a couple of lines, one of which calls my method for modifying an entry in the database, and one to read it back and display it. When I ran this test on a specific record, the update didn't stick: no matter what I tried to write, it always came back to my script as an empty string. And the utterly evil part was that &lt;I style="mso-bidi-font-style: normal"&gt;no errors were generated&lt;/I&gt;. It turns out that if the field contained an actual NULL value (not an empty string) then the update would silently fail.&lt;/P&gt;
&lt;H2 style="MARGIN: 12pt 0in 3pt"&gt;&lt;FONT size=3&gt;The Workaround&lt;/FONT&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Since I own the database I'm trying to write to, I have the flexibility to go in and disallow NULL values on the fields I want to modify from OLE. When setting up this constraint, I also needed to provide an empty string as a default value (using two single quotes: '').&lt;/P&gt;
&lt;H2 style="MARGIN: 12pt 0in 3pt"&gt;&lt;FONT size=3&gt;The Code&lt;/FONT&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;For the people (like myself) that prefer to see working samples, here is the code I used.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;The SQL statement to create the table I will be writing too, notice the NOT NULL and DEFAULT values.&lt;/P&gt;
&lt;DIV style="BACKGROUND-COLOR: #aaaaaa"&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;CREATE TABLE&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; [Metrics](&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[MetricID] [uniqueidentifier] &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;NOT NULL CONSTRAINT&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; [DF_Metrics_MetricID]&lt;/FONT&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;DEFAULT&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; (newid()),&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[Name] [varchar](64) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;NOT NULL CONSTRAINT&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; [DF_Metrics_Name]&lt;/FONT&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;DEFAULT&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; (&lt;/FONT&gt;&lt;SPAN style="COLOR: #990000"&gt;''&lt;/SPAN&gt;&lt;FONT color=#050505&gt;),&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[Contact] [varchar](32) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;NOT NULL CONSTRAINT&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; [DF_Metrics_Contact]&lt;/FONT&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;DEFAULT&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; (&lt;/FONT&gt;&lt;SPAN style="COLOR: #990000"&gt;''&lt;/SPAN&gt;&lt;FONT color=#050505&gt;),&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[Units] [varchar](16) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;NOT NULL CONSTRAINT&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; [DF_Metrics_Units]&lt;/FONT&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;DEFAULT&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; (&lt;/FONT&gt;&lt;SPAN style="COLOR: #990000"&gt;''&lt;/SPAN&gt;&lt;FONT color=#050505&gt;),&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[Description] [text] &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;NOT NULL CONSTRAINT&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; [DF_Metrics_Description]&lt;/FONT&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;DEFAULT&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; (&lt;/FONT&gt;&lt;SPAN style="COLOR: #990000"&gt;''&lt;/SPAN&gt;&lt;FONT color=#050505&gt;),&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[CustomURL] [varchar](256) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;NOT NULL CONSTRAINT&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; [DF_Metrics_CustomURL]&lt;/FONT&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;DEFAULT&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; (&lt;/FONT&gt;&lt;SPAN style="COLOR: #990000"&gt;''&lt;/SPAN&gt;&lt;FONT color=#050505&gt;),&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;CONSTRAINT&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; [PK_Metrics] &lt;/FONT&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;PRIMARY KEY CLUSTERED&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa" face="Courier New" color=#050505&gt;(&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[MetricID] &lt;/FONT&gt;&lt;/FONT&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa" color=#0000ff&gt;ASC&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#050505&gt;)&lt;/FONT&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;WITH&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; (PAD_INDEX&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;= OFF, STATISTICS_NORECOMPUTE&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;= OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;= ON, ALLOW_PAGE_LOCKS&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color=#050505&gt;= ON) &lt;/FONT&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;ON&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; [PRIMARY]&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#050505&gt;) &lt;/FONT&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;ON&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt; [PRIMARY] TEXTIMAGE_ON [PRIMARY]&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;The code to open the database:&lt;/P&gt;
&lt;DIV style="BACKGROUND-COLOR: #aaaaaa"&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;lastError = dbSource.OpenFromInitializationString(L&lt;/FONT&gt;&lt;/FONT&gt;&lt;SPAN class=CodequotedstringChar&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa" color=#700000&gt;"DRIVER={SQL Server};SERVER=myserver;"&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;L&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN class=CodequotedstringChar&gt;&lt;FONT color=#700000&gt;"DATABASE=mydatabase;UID=username;PWD=password;"&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa" face="Courier New" color=#050505&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;&lt;FONT color=#050505&gt;(FAILED(lastError))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt;&lt;FONT color=#050505&gt; lastError;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa" face="Courier New" color=#050505&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;lastError = dbSession.Open(dbSource);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;&lt;FONT color=#050505&gt;(FAILED(lastError))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;dbSource.Close();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt;&lt;FONT color=#050505&gt; lastError;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Here is the code I used to open and edit the record.&lt;/P&gt;
&lt;DIV style="BACKGROUND-COLOR: #aaaaaa"&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;CCommand&amp;lt;CDynamicStringAccessorW&amp;gt; recordset;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa" face="Courier New" color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;CDBPropSet propset(DBPROPSET_ROWSET);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;propset.AddProperty(DBPROP_IRowsetChange, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;&lt;FONT color=#050505&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;propset.AddProperty(DBPROP_IRowsetUpdate, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;&lt;FONT color=#050505&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa" face="Courier New" color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeComment style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#008000&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;// the MetricID is hard coded here for sample purposes&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class=CodekeywordChar&gt;&lt;FONT color=#0000ff&gt;char&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#050505&gt;* sql = L&lt;/FONT&gt;&lt;SPAN class=CodequotedstringChar&gt;&lt;FONT color=#700000&gt;"SELECT [Contact] FROM Metrics WHERE [MetricID] = "&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN class=CodequotedstringChar&gt;&lt;FONT color=#700000&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;L"'{00000000-0000-0000-0000-000000000000}'";&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa" face="Courier New" color=#050505&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;lastError = recordset.Open(dbSession, sql, &amp;amp;propset);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;&lt;FONT color=#050505&gt;(FAILED(lastError))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;goto&lt;/SPAN&gt;&lt;FONT color=#050505&gt; cleanup;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa" face="Courier New" color=#050505&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;lastError = recordset.MoveFirst();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;&lt;FONT color=#050505&gt;(FAILED(lastError))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;goto&lt;/SPAN&gt;&lt;FONT color=#050505&gt; cleanup;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;&lt;FONT color=#050505&gt;(lastError == DB_S_ENDOFROWSET) &lt;/FONT&gt;&lt;SPAN class=CodeCommentChar&gt;&lt;FONT color=#008000&gt;// row not found&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;lastError = 0x80000000 | DB_S_NORESULT;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;goto&lt;/SPAN&gt;&lt;FONT color=#050505&gt; cleanup;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa" face="Courier New" color=#050505&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;lastError = recordset.SetString(1, newVal);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;&lt;FONT color=#050505&gt;(FAILED(lastError))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;goto&lt;/SPAN&gt;&lt;FONT color=#050505&gt; cleanup;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa" face="Courier New" color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;lastError = recordset.SetData();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;&lt;FONT color=#050505&gt;(FAILED(lastError))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;goto&lt;/SPAN&gt;&lt;FONT color=#050505&gt; cleanup;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa" face="Courier New" color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;lastError = recordset.Update();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;&lt;FONT color=#050505&gt;(FAILED(lastError))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;goto&lt;/SPAN&gt;&lt;FONT color=#050505&gt; cleanup;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa" face="Courier New" color=#050505&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;cleanup:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#050505&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;recordset.Close();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT style="BACKGROUND-COLOR: #aaaaaa"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#050505&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt;&lt;FONT color=#050505&gt; lastError;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8322019" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/joshpoley/archive/tags/C_2F00_C_2B002B00_/default.aspx">C/C++</category><category domain="http://blogs.msdn.com/joshpoley/archive/tags/Database/default.aspx">Database</category></item></channel></rss>