<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408612&amp;view=findpost&amp;p=3665890</guid>
        <pubDate>Thu, 14 Apr 2016 16:23:29 +0000</pubDate>
        <title>Как исправить данные в базе Access при изменении в строке таблицы</title>
        <link>https://forum.sources.ru/index.php?showtopic=408612&amp;view=findpost&amp;p=3665890</link>
        <description><![CDATA[tuchin: Пытаюсь внести исправления, сделанные в таблице, в базу данных:<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;case 3: // изменить таблицу</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int numRow = dataGridView1.CurrentRow.Index;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;string sID &nbsp;= (string) dataGridView1.Rows[numRow].Cells[0].Value; //.FormattedValue.ToString();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sTableName &nbsp;= dataGridView1.Rows[numRow].Cells[1].FormattedValue.ToString();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sTextResult = dataGridView1.Rows[numRow].Cells[2].FormattedValue.ToString();</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;str = &quot;UPDATE ListTable SET tblName = &quot; + &quot;&#39;&quot; + sTableName &nbsp;+ &nbsp;&quot;&#39;&quot; + &quot;,&quot; +</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot; tblResult = &quot; &nbsp;+ &quot;&#39;&quot; + sTextResult + &nbsp;&quot;&#39;&quot; + &quot; WHERE idTable = &quot; // + sID; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot;&#39;&quot; + sID &nbsp; &nbsp; &nbsp; &nbsp; + &nbsp;&quot;&#39;&quot;;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; command.CommandText = str;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; command.ExecuteNonQuery();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script>Получаю ошибку: &quot;Необработанное исключение типа &quot;System.Data.OleDb.OleDbException&quot; произошло в System.Data.dll. Дополнительные сведения: Несоответствие типов данных в выражении условия отбора&quot;. Как я понимаю, ошибка связана с тем, что sID должен быть числовым, а не строковым. К сожалению, не знаю, как правильно сформировать строку запроса, чтобы sID был числовым и одновременно можно было бы его использовать в строке запроса. Помогите, пожалуйста. Проект прикрепил.<br>
<span class="b-attach" data-size="25697" data-hits="623" data-attach-id="49270" data-attach-post-id="3665890">
			<span class="b-attach__title"></span><a class='b-attach-link' href='https://forum.sources.ru/index.php?act=Attach&amp;type=post&amp;id=3665890&amp;attach_id=49270' title='Скачать файл' target='_blank'>DBtest.zip</a> (, : 623)
		</span>]]></description>
        <author>tuchin</author>
        <category>.NET: Базы данных</category>
      </item>
	
      </channel>
      </rss>
	